Directory Structure Visualizer

🌱 Seedling
#cli 2 minutes read 01 Jul, 2023

I wanted an easy way in which I could visualise any directory that i’m navigating on the CLI. Yes, you did have standard npm packages such as “tree” for example, but those were not very helpful for me to understand the overall size of the files. I wanted a more “detailed” tree that could help me gauge how the codebase looks like.

For this reason, I created this package — dftree. This generates more visual UX-friendly representations of directory structures using Unicode box-drawing characters.

You can find the dftree npm package for installation instructions and usage details. This utility helps developers:

  • Visualize complex folder structures in the terminal
  • Generate directory trees for documentation
  • Explore project organization with customizable output
  • Export directory structure as text files or for console display

The tool uses a depth-first traversal algorithm to generate the tree visualization with proper indentation and branch characters.

Example output:

📂 project-root
├── 📂 src
│   ├── 📂 components
│   │   ├── 📄 Button.jsx
│   │   └── 📄 Card.jsx
│   ├── 📂 utils
│   │   └── 📄 helpers.js
│   └── 📄 index.js
├── 📄 README.md
└── 📄 package.json

Install it globally with:

npm install -g dftree

This package is a handy utility for visualizing project structures.

Found a typo or want to suggest changes? Send a PR on GitHub

Liked this post? Get email for new ones:

Here are some popular posts you might like

Insights are not just a salad of facts

What is an insight? An insight for Elon was: "The most entertaining outcome was the most likely'. His tweet suggests that he believes in taking risks and embracing the unknown, rather than playing it safe....

design
Essay Quality Ranker

Ever found yourself with dozens of draft essays in Obsidian but no clear idea which ones need the most editing work? I did, and that's why I built EditNext - an AI-powered plugin that ranks your markdown files based on how much editing they need. The EditNext plugin uses LLMs and linguistic analysis to evaluate your drafts, providing a prioritized list of which documents deserve your attention first. It's like having an editorial assistant that helps you focus your efforts where they'll have the most impact....

obsidian
Hyperpersonalised N=1 learning

For decades, formal education has resembled a Procrustean bed—a system that stretches or cuts students to fit a rigid mold, regardless of their needs, talents, or pace. ![](https://miro.medium.com/v2/resize:fit:1400/1*02A1LwPs4q0tADh15OGpPA.jpeg)...

education
Vibe coding with Cursor

I used to run my blog on [Ghost CMS](https://ghost.org/) hosted on a [Digital Ocean](https://digitalocean.com/) droplet for $20/mo. Now I do all that for $0/mo using [AstroJS](https://astro.build/), [Cloudflare pages hosting](https://cloudflare.com/). I didn't make any major tradeoffs, I just ditched the old way of relying on third party services to serve my software needs. And I fancied the idea of building my own site from scratch by just vibe-coding all the way — By just talking out loud to Cursor IDE in English and suggesting it what to do. Cursor's Composer does a great job at interpreting the enchantment in the context of the larger codebase I'm working with, and to auto-pilot these improvements....

rough-notes
In-person vision transmission

I recently transitioned from leading a product team in a region to a more centralised role overseeing products across multiple geographies. As part of that transition, I needed to onboard the new product lead of that region, ensuring they were fully briefed While a virtual onboarding could have covered the basic documents and data points, I knew an in-person handoff was crucial. Slide decks can lay out objectives, milestones, and KPIs all day long, but it would definitely lack that oomph factor of an in-person transmission. This was one of the rituals which warrant an in-person interaction even while almost 90% of our interactions are virtual....

rough-notes