DEV Community

Otto
Otto

Posted on

Stop Building Boilerplate: 5 Node.js REST API Starters You Can Ship Today

Every new Node.js project starts the same way.

You open a terminal. Create a folder. npm init. Install Express. Add CORS. Set up dotenv. Configure error handling. Write a health route to test if it works.

And you've done this exact thing 10 times before.

The Setup Tax

I call it the setup tax — the 30-60 minutes you spend on infrastructure before writing a single line of business logic.

Multiply that by every project you start in a year, and you're looking at days of lost time.

I finally got tired of it and packaged 5 production-ready Node.js REST API boilerplates into a single kit.

The 5 Boilerplates

1. api-basic — Minimal Express REST API

The clean slate. Express + CORS + Helmet + Morgan + dotenv. Health endpoint, users route, error handler. Zero bloat.

npm install
cp .env.example .env
npm run dev
# Server running on port 3000
Enter fullscreen mode Exit fullscreen mode

2. api-auth — JWT Authentication + Refresh Tokens

Full auth flow: register, login, refresh token, logout. bcryptjs for password hashing, JWT for access tokens, separate refresh token rotation.

// POST /api/auth/login
// Returns: { accessToken, refreshToken }

// POST /api/auth/refresh
// Returns: { accessToken }
Enter fullscreen mode Exit fullscreen mode

3. api-crud — Full CRUD with MongoDB/Mongoose

Complete data layer. Item model with validation, full CRUD routes, MongoDB connection with graceful error handling.

// GET    /api/items
// POST   /api/items
// PUT    /api/items/:id
// DELETE /api/items/:id
Enter fullscreen mode Exit fullscreen mode

4. api-full — The Complete App

Auth + CRUD + validation + centralized error handling. Protected routes require a valid JWT. The one boilerplate to rule them all.

5. api-docker — Docker + docker-compose Ready

Same as api-full but with a production-ready Dockerfile and docker-compose that spins up the API and MongoDB together.

docker-compose up --build
# API at http://localhost:3000
# MongoDB at localhost:27017
Enter fullscreen mode Exit fullscreen mode

What Each Boilerplate Includes

  • Clean, commented source code
  • package.json with pinned dependencies
  • .env.example with all required variables
  • Centralized error handling middleware
  • README.md with step-by-step setup

Why Not Just Use a Generator?

Generators (like express-generator) give you a skeleton. These boilerplates give you a working app with real patterns — the kind of code you'd actually write in production, not a tutorial example.

The difference matters when you're onboarding a client project or spinning up a side project at midnight.

Get the Pack

All 5 boilerplates are available as a single download: Node.js REST API Boilerplate Pack — €19.99.

Less than an hour of most developers' time. Saves you hours on every project.


What setup do you find yourself repeating on every project? Drop it in the comments — might be the next boilerplate.

Top comments (0)