πŸš€ Big News:Socket Has Acquired Secure Annex.Learn More β†’
Socket
Book a DemoSign in
Socket

@nhankyjangchan/project-structure-generator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nhankyjangchan/project-structure-generator

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

latest
Source
npmnpm
Version
1.2.2
Version published
Weekly downloads
164
-53.54%
Maintainers
1
Weekly downloads
Β 
Created
Source

@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

FlagDescription
--tsCopies tsconfig.json instead of jsconfig.json (mutually exclusive).
--prettierCopies .prettierignore and .prettierrc.json configuration files.
--use-customUses your custom preset (directories + templates) instead of the default one.
--templateLoads a single template file from the custom preset by name. Requires --use-custom.
--forceIgnores the "empty directory" check and forces the creation of folders/files (overwrites existing files).
--hDisplays help format.

Config Management Flags

FlagDescription
--configEnters config mode for managing custom presets.
--modify-dirlistAppends comma-separated directory names to your custom dirlist.txt.
--clear-dirlistClears all entries from your custom dirlist.txt.
--append-templateAdds a new template file to your custom preset from a given path.
--delete-templateRemoves 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.txt β†’ Dockerfile).

Releases

CHANGELOG

License

MIT

Keywords

scaffold

FAQs

Package last updated on 30 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts