A powerful CLI tool that generates complete folder structures from simple text diagrams. Perfect for quickly scaffolding projects, boilerplates, or standardized directory layouts.
- Generate nested folders and files with a single command
- Supports both direct input and file input
- Cross-platform (Windows, macOS, Linux)
- Clear visual feedback with color-coded output
- Flexible output directory specification
- Lightweight with minimal dependencies
npm install -g folder-generator
npm install folder-generator --save-dev
foldgen --input "src/
├── App.js
├── index.js
└── components/
├── Button.js
└── Header.js"
npx folder-generator --file structure.txt
foldgen --file structure.txt
echo "config/
├── default.json
└── production.json" | foldgen
foldgen --file structure.txt --output ./my-project
The generator understands standard tree diagram notation:
project/
├── README.md
├── src/
│ ├── index.js
│ └── utils/
│ └── helpers.js
└── tests/
└── index.test.js
Special Characters:
-
├──
for intermediate items -
└──
for the last item in a level -
│
for vertical connections - Spaces for indentation (4 spaces per level)
const { parseStructure, createFiles } = require('folder-generator');
const structure = parseStructure(`src/index.js`);
createFiles(structure, './output');
React Project (react-structure.txt):
src/
├── App.jsx
├── index.js
├── components/
│ ├── Button/
│ │ ├── index.jsx
│ │ └── styles.module.css
│ └── Header.jsx
├── pages/
│ └── Home.jsx
└── utils/
└── api.js
Node.js API (node-structure.txt):
app/
├── config/
│ └── database.js
├── controllers/
│ └── userController.js
├── models/
│ └── User.js
├── routes/
│ └── api.js
├── app.js
└── package.json
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
MIT © Shreyash Ghanekar
- Inspired by the need for quick project scaffolding
- Built with Node.js and love