npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

treemk

v1.0.4

Published

A CLI tool to generate project structures from text, JSON templates, file, with boilerplate and git integration

Readme

🌳 treemk 📦 - Project Structure Generator

Generate complete project folders in seconds

🚀 Quick Start (3 Ways)

1. Inline Text (Easiest!)

npx treemk --text "src/index.js
src/app.js
tests/test.js
README.md" -o ./myapp

2. Inline JSON

npx treemk --json-input '{"src":["index.js","app.js"],"tests":["test.js"]}' -o ./myapp

3. From File

npx treemk -i structure.txt -o ./myapp

📥 Installation

# Use directly (recommended)
npx treemk --help

# Or install globally
npm install -g treemk

🎯 Common Use Cases

Create a Node.js API

npx treemk --template node -o ./my-api --boilerplate --install --git-init

Create React App

npx treemk --template react -o ./my-react-app --boilerplate

Save Your Own Template

# Save once
npx treemk --text "src/server.js
src/routes/api.js
tests/test.js" --template-save my-api

# Reuse forever
npx treemk --template-use my-api -o ./new-api

Preview Before Creating

npx treemk -i structure.txt --preview

📝 Input Formats

Plain Text (Simple)

src/index.js
src/components/App.jsx
tests/test.js
package.json

Tree Format (Visual)

my-app/
├── src/
│   ├── index.js
│   └── components/
│       └── App.jsx
└── package.json

JSON Format

{
  "src": {
    "components": ["App.jsx"],
    "index.js": null
  },
  "package.json": null
}

🎨 Smart Boilerplate (--boilerplate)

Automatically generates working code for:

  • server.js → Express server ready to run
  • route.js → RESTful API routes
  • model.js → Database models
  • test.js → Jest test setup
  • .env → Environment variables template
  • .gitignore → Comprehensive ignore rules
  • Dockerfile → Docker configuration
  • And more!

📋 All Commands

Basic

-i, --input <file>      # File path (works from anywhere!)
-o, --output <path>     # Where to create (default: ./output)
-b, --boilerplate       # Add smart code templates
-h, --help              # Show help

Templates

--template <name>           # Use: react, node, python
--template-save <name>      # Save for reuse
--template-use <name>       # Load saved template
--template-list             # Show all templates
--template-remove <name>    # Delete template

Inline Input (No files!)

--text "<structure>"        # Pass structure directly
--json-input '<json>'       # Pass JSON directly

Git

-g, --git-init         # Initialize git
--git-commit           # Make first commit
--git-push             # Push to GitHub (needs gh CLI)

Advanced

--install              # Auto npm/pip install
--preview              # Show tree preview
-u, --from-url <url>   # Fetch from URL
-d, --dry-run          # Preview without creating

💡 Real Examples

Example 1: Quick Microservice

npx treemk --text "src/server.js
src/routes/users.js
src/routes/products.js
src/models/User.js
tests/api.test.js
.env
.gitignore
package.json" -o ./my-service -b --install -g

Example 2: Python Project

npx treemk --template python -o ./my-python-app -b --install --git-init

Example 3: From Anywhere

# File in Downloads folder? No problem!
npx treemk -i structure.txt -o ./app

# File on Desktop? Works!
npx treemk -i ~/Desktop/project.txt -o ./app

Example 4: Full Automation

npx treemk --template node \
  -o ./api \
  --boilerplate \
  --install \
  --git-init \
  --git-commit

⚙️ Config File (Optional)

Create treemk.config.json in your project folder:

{
  "output": "./app",
  "boilerplate": true,
  "gitInit": true,
  "install": true
}

Then just run:

npx treemk --template node

📂 Where Templates Are Saved

~/.treemk/templates/ - Your saved templates live here

🔍 Troubleshooting

"Cannot find file"

  • Try absolute path: /home/user/structure.txt
  • Or just filename if in Downloads/Documents/Desktop
  • Use --text to avoid files entirely!

"No input provided"

# Use one of these:
npx treemk --text "src/index.js"
npx treemk -i file.txt
npx treemk --template node
cat file.txt | npx treemk -o ./app

📦 Requirements

  • Node.js 16+ (check: node --version)
  • npm comes with Node.js
  • Optional: gh CLI for GitHub push

🎓 Complete Tutorial

See [QuickStart.md] for step-by-step guide.

📄 License

MIT License - Free to use for everyone!

⭐ Quick Reference Card

# Fastest ways to create projects:
npx treemk --template node -o ./app -b         # Node.js
npx treemk --template react -o ./app -b        # React
npx treemk --template python -o ./app -b       # Python

# No file needed:
npx treemk --text "src/index.js..." -o ./app

# Save template once, use forever:
npx treemk -i my-structure.txt --template-save my-template
npx treemk --template-use my-template -o ./new-project

Made for developers who value speed! ⚡