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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nhankyjangchan/project-structure-generator

v1.2.2

Published

Minimal and flexible CLI tool to scaffold a standardized Node.js/Bun backend folder structure with optional TypeScript, Prettier, and custom preset support

Readme

@nhankyjangchan/project-structure-generator

npm version github repo node version npm downloads unpacked Size last update license

Minimal and flexible CLI tool to scaffold a standardized Node.js or Bun backend folder structure. It generates essential directories and copies configuration boilerplates so you can focus on writing code instead of setting up the skeleton.

✨ Features

  • Zero Config by Default – Run psg and you're ready to go.
  • Predefined Structure – Automatically creates src/ with subfolders like config, controllers, models, middlewares, etc.
  • Boilerplate Files – Copies template files from the built-in library.
  • Custom Presets – Create and manage your own directory lists and templates.
  • Single Template Loading – Pull individual templates from your custom preset on demand.
  • Safety First – Refuses to run in a non-empty directory unless --force is provided.
  • Interactive Confirmation – Asks for explicit user consent before making any changes.

📦 Installation

npm i -g @nhankyjangchan/project-structure-generator

🛠️ Usage

Navigate to your project folder and run the command:

psg [flags]

The CLI will check if the directory is empty, display a confirmation prompt, and then generate the structure.

⚙️ Options

Scaffold Flags

| Flag | Description | | :------------- | :-------------------------------------------------------------------------------------------------------- | | --ts | Copies tsconfig.json instead of jsconfig.json (mutually exclusive). | | --prettier | Copies .prettierignore and .prettierrc.json configuration files. | | --use-custom | Uses your custom preset (directories + templates) instead of the default one. | | --template | Loads a single template file from the custom preset by name. Requires --use-custom. | | --force | Ignores the "empty directory" check and forces the creation of folders/files (overwrites existing files). | | --h | Displays help format. |

Config Management Flags

| Flag | Description | | :------------------ | :-------------------------------------------------------------------- | | --config | Enters config mode for managing custom presets. | | --modify-dirlist | Appends comma-separated directory names to your custom dirlist.txt. | | --clear-dirlist | Clears all entries from your custom dirlist.txt. | | --append-template | Adds a new template file to your custom preset from a given path. | | --delete-template | Removes a template file from your custom preset by name. |

📋 Examples

Basic JavaScript Project (Default)

mkdir my-cool-api
cd my-cool-api
psg

Result: Creates jsconfig.json and all default directories.

TypeScript Project with Prettier

mkdir my-ts-api
cd my-ts-api
psg --ts --prettier

Result: Creates tsconfig.json (skips jsconfig.json), adds Prettier configs, and creates the standard folder structure.

Override Non-Empty Directory

psg --force

Result: Copies all applicable files and creates directories, potentially overwriting existing files with the same names.

Use Custom Preset

psg --use-custom

Result: Generates the project using your custom dirlist.txt and templates/ instead of the built-in defaults.

Load a Single Custom Template

psg --use-custom --template .env.production

Result: Creates the custom directory structure, copies only .env.production.txt (without .txt extension) from your custom templates, and skips all other template files.

Manage Custom Preset

# Add directories to your custom preset
psg --config --modify-dirlist "src/routes,src/services,src/validators"

# Add a template file
psg --config --append-template /path/to/my-config.json

# Remove a template
psg --config --delete-template old-config.json

# Reset your dirlist
psg --config --clear-dirlist

📂 Generated Structure

After running the command, your project root will look like this:

.
├── .env.development    # Environment variables template
├── .gitignore          # Node.js specific ignore rules
├── .prettierignore     # Prettier ignore rules (with --prettier)
├── .prettierrc.json    # Basic formatting config (with --prettier)
├── jsconfig.json       # JavaScript configuration (default)
├── package.json        # Package manifest
├── tsconfig.json       # TypeScript configuration (with --ts)
└── src/
    ├── config/
    ├── controllers/
    ├── handlers/
    ├── middlewares/
    ├── models/
    ├── plugins/
    ├── routing/
    └── utils/

📂 Custom Presets

Custom presets are stored alongside the package in the config/custom/ directory:

config/
├── base/               # Built-in default preset (shipped with package)
│   ├── dirlist.txt
│   └── templates/
└── custom/             # Your personal preset (created on demand)
    ├── dirlist.txt
    └── templates/
  • dirlist.txt — comma-separated list of directories to create (e.g. src/routes,src/services).
  • templates/ — any .txt files placed here will be copied to the project root with the .txt extension stripped (e.g. Dockerfile.txtDockerfile).

Releases

CHANGELOG

License

MIT