#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · DOWNLOAD AS ZIP

Node.js Project Structure Generator: Start Every API the Right Way

Choose your options and download a ready Express project skeleton as a ZIP.

  • 🗂️ Layered folder structure
  • 🟦 JavaScript or TypeScript
  • 🧪 Jest + Supertest

How to use the Node.js Project Structure Generator

  1. 1. Name the projectUse lowercase letters and hyphens, like student-api.
  2. 2. Pick optionsJavaScript or TypeScript, database, tests, ESLint and Docker.
  3. 3. Download the ZIPUnzip, run npm install, copy .env.example to .env and npm run dev.

The structure explained

The skeleton separates responsibilities, the way most professional Node.js teams do:

  • routes/ map URLs to controller functions.
  • controllers/ read the request and send the response.
  • services/ hold business logic, so it can be tested without HTTP.
  • models/ hold database schemas (created for MongoDB or PostgreSQL).
  • middlewares/ hold shared steps like the error handler.
  • config/ holds settings such as the database connection.

app.js builds the Express app and server.js starts it. Keeping them apart lets tests import the app without opening a port. Secrets go in .env, which is in .gitignore; .env.example shows which variables are needed.

Worked example

The defaults (student-api, JavaScript, CommonJS, MongoDB, tests on) give 11 files in 9 folders, with 3 dependencies (express, dotenv and mongoose) and 2 dev dependencies (jest and supertest). Empty folders like services/ and utils/ hold a .gitkeep file so Git keeps them. The health route works straight away:

npm install
cp .env.example .env
npm run dev
# open http://localhost:3000/api/health

npm test runs a Supertest check that /api/health returns status ok. The dev script uses node --watch, built into Node 18.11+, so there is no need for nodemon. Choosing TypeScript adds tsconfig.json and uses tsx for development and tsc for the build.

Frequently asked questions

Which Node.js version do I need?

Node 18 or newer. Node 22 LTS is a good choice for new projects.

Are the package versions current?

They are recent versions with ^ ranges, so npm install picks the newest compatible release. Check npm for major updates now and then.

Is this the only right structure?

No, but routes, controllers, services and models is a widely used, easy-to-follow pattern for REST APIs.

Is the node.js project structure generator free?

Yes, it is free. Downloading your first project asks for your name and WhatsApp number once. After that, the node.js project structure generator and every other Uncodemy tool open with no form.

More free tools

See all free tools