MENU

Project Structure

Repository

I developed Project Structure to solve the common need for clear, visual project documentation. This high-performance CLI tool generates ASCII directory trees while respecting .gitignore rules, providing a clean overview of even the most complex codebases. By leveraging Rust's speed and powerful library ecosystem, I created a utility that is both highly customizable and significantly faster than traditional shell-based alternatives.

Modular CLI Architecture

The tool is built with a highly modular architecture, separating the concerns of directory walking, tree building, and output rendering. I used the clap crate to implement a robust command-line interface with support for diverse flags—including hidden file visibility, depth limits, and custom sorting options. This design allows for easy extension, such as adding new output formats or filtering logic, without modifying the core recursive walker.

Git-Aware Directory Walking

To ensure the generated trees are free of "bloat" like target/ or node_modules/, the tool implements a git-aware directory walker. It parses .gitignore files in the root directory and applies these patterns in real-time as it traverses the file system. This logic is decoupled from the rendering stage, ensuring that the internal representation of the directory tree is accurate and concise before any ASCII characters are generated.

Custom Rendering Engine

The ASCII rendering engine was custom-built to support different tree styles and symbols. It uses a recursive approach to calculate the necessary vertical bars and branch connectors, ensuring a clean visual hierarchy. By parameterizing the renderer, I made it easy to switch between standard ASCII and modern UTF-8 symbols, or even generate the structure as a formatted Markdown code block, which is ideal for inclusion in README.md files.

High-Performance Execution

By choosing Rust, the tool achieves exceptional execution speed. Even when processing large repositories with tens of thousands of files, Project Structure can generate and render the tree in under 50ms. The project taught me the importance of efficient file system access and the power of building small, focused utilities that do one thing exceptionally well.