A ready-to-use, secure, and scalable boilerplate for new Node.js & Express.js server projects.
This project is designed to help you skip the repetitive setup process. It comes pre-configured with a complete Authentication & Authorization system, so you can start building your core application logic immediately.
This boilerplate comes packed with essential features:
- 🔐 Secure Authentication: Full JWT (Access & Refresh Tokens) flow for user login and registration.
- 🛡️ Password Hashing: Uses
bcryptfor securely hashing and comparing passwords. - 🔒 Route Protection: Pre-built middleware to easily protect routes based on user roles or login status.
- 📦 TypeScript Ready: Built with TypeScript for a type-safe, scalable, and maintainable codebase.
- ⚙️ Environment Variables: All configurations are loaded from
.envfiles usingdotenv. - ✨ Linting & Formatting: Pre-configured
ESLintandPrettierfor clean, consistent code. - 🔄 Development Server: Uses
ts-node-dev(or similar) for automatic server restarts on file changes. - 🛡️ Robust Validation: Ready for
ZodorJoito validate incoming request bodies.
| Category | Technology |
|---|---|
| Backend | Express.js |
| Language | TypeScript |
| Database | [MongoDB (Mongoose)] or [PostgreSQL (Prisma)] |
| Authentication | jsonwebtoken (JWT), bcrypt |
| Validation | [Zod / Joi / express-validator] |
| Config | dotenv |
| Dev Tools | ts-node-dev, eslint, prettier |
Follow these steps to start your new project using this boilerplate.
You have two options:
Option 1 (Recommended): Use as a GitHub Template
- Click the green "Use this template" button at the top of this repository page.
- Choose "Create a new repository".
- Give your new repository a name (e.g.,
my-new-api-server). - Clone your newly created repository:
git clone [https://github.com/](https://github.com/)[YOUR-USERNAME]/[YOUR-NEW-REPO-NAME].git cd [YOUR-NEW-REPO-NAME]
Option 2: Clone Manually
- Clone this boilerplate repository:
git clone [https://github.com/](https://github.com/)[YOUR-USERNAME]/[THIS-BOILERPLATE-REPO].git cd [THIS-BOILERPLATE-REPO] - Remove the existing Git history to start fresh:
rm -rf .git git init
Install all the necessary packages.
npm install