node-student-scaffold
v1.0.0
Published
A tiny CLI that scaffolds a beginner-friendly Express + MongoDB starter API for students.
Maintainers
Readme
node-student-scaffold
A tiny CLI that scaffolds a beginner-friendly Express + MongoDB starter API for students.
Run it inside an empty (or existing) Git repository and it creates the whole project in the current directory — no nested project folder.
npx node-student-scaffoldWhat it creates
.
├── src/
│ ├── controllers/
│ │ └── user.controller.js
│ ├── models/
│ │ └── user.model.js
│ ├── routes/
│ │ └── user.routes.js
│ ├── config/
│ │ └── db.js
│ ├── app.js
│ └── server.js
├── .env.example
├── .gitignore
├── package.json
└── README.md- CommonJS (
require) — no TypeScript, no bundlers, no framework magic. - A
UserCRUD example:GET /api/users,GET /api/users/:id,POST /api/users,PUT /api/users/:id,DELETE /api/users/:idplusGET /health. - MongoDB is optional. If
MONGO_URIis set in.envit uses MongoDB (Mongoose); if not, the CRUD example still works using an in-memory array so students can learn without a database.
Package structure
node-student-scaffold/
├── bin/
│ └── cli.js # the CLI entry point (declared in package.json "bin")
├── templates/ # the project files copied verbatim into the current dir
│ ├── src/
│ ├── .env.example
│ ├── .gitignore
│ ├── package.json
│ └── README.md
├── test/
│ └── cli.test.js # smoke tests (node --test, zero dependencies)
├── package.json
└── README.mdHow the CLI works
npx node-student-scaffoldrunsbin/cli.js.- It checks the current directory: if it already contains files (ignoring
.git), it asks "This directory already contains files. Continue? (y/N)". Files are never silently overwritten — answer is anything buty/yes, it aborts. - It copies everything from
templates/intoprocess.cwd()usingfs.cpSync(recursive: true). The.env.example,.gitignore, andsrc/…files land directly in the current directory — no nested folder. - Any
.envyou already have is untouched (the templates never include a.env).
Test locally
npm install # install dev tooling (none required for the CLI itself)
npm link # make the `node-student-scaffold` command available globally
npm test # run the smoke tests
# Then try it in a scratch folder:
mkdir /tmp/demo && cd /tmp/demo
node-student-scaffold # or: npx node-student-scaffold
npm install
npm run dev # visit http://localhost:3000/healthPublish to npm
npm version patch
npm publish # requires an npm account + `npm login` firstAfter publishing, anyone runs npx node-student-scaffold in an empty repo to get the starter project.
Student workflow
git clone <my-github-repo>
cd <repo>
npx node-student-scaffold
npm install
npm run devThen open http://localhost:3000/health — and read the generated README.md for the API examples.
License
MIT
