Enterprise-Grade • Production-Ready • Open Source

node-enterprise-starter

Comprehensive documentation to help you build scalable Node.js applications with our enterprise-ready boilerplate

Quick Installation

Choose your package manager:

$npx node-enterprise-starter

Interactive CLI prompts:

1. Enter your project name

2. Select your package manager

3. Wait for the setup to complete

4. cd node-enterprise-starter

5. npm run dev

Interactive CLI

User-friendly command line interface that guides you through the setup process step by step.

Instant Startup

Get your development server up and running in seconds with all dependencies pre-configured.

Zero Config

No complex configuration required. Just install and start building your application logic.

Environment Configuration

.env.example
NODE_ENVdevelopmentApplication environment
PORT8000Server port
DATABASE_URLmongodb://localhost:27017/myappMongoDB connection string
BCRYPT_SALT_ROUNDS10Password hashing strength
JWT_ACCESS_SECRETsupersecretaccesskey123JWT access token secret key
JWT_ACCESS_EXPIRES_IN7dJWT access token expiry
JWT_REFRESH_SECRETsupersecretrefreshkey456JWT refresh token secret key
JWT_REFRESH_EXPIRES_IN30dJWT refresh token expiry
EMAIL_USERnoreply@myapp.comEmail service username
EMAIL_PASSWORDpassword123Email service password
RESET_LINK_URLhttps://myapp.com/reset-passwordPassword reset link URL
CLIENT_URLhttp://localhost:3000Frontend application URL
ADMIN_PROFILE_IMAGE_LINKhttps://myapp.com/images/admin-profile.pngDefault admin profile image
ADMIN_CONTACT+1-234-567-8901Admin contact information
ADMIN_PASSWORDadminpassword123Admin default password
ADMIN_EMAILadmin@myapp.comAdmin email address
ADMIN_NAMEAbu JobayerAdmin display name

Setup Instructions

  1. 1

    Rename .env.example > .env

  2. 2

    Configure your MongoDB connection string in DATABASE_URL

  3. 3

    Set secure values for JWT secrets and admin credentials

  4. 4

    Configure email settings if you plan to use password reset functionality

  5. 5

    After connecting to the MongoDB server, the admin user will be auto-seeded

Project Structure

Directory Structure

node-enterprise-starter/
├── src/
│   ├── app/
│   │   ├── errors/
│   │   ├── middlewares/
│   │   ├── modules/
│   │   │   ├── Auth/
│   │   │   ├── User/
│   │   │   └── ...
│   │   ├── routes/
│   │   └── services/
│   │   ├── utils/
│   ├── config/
│   ├── shared/
│   │   ├── constants/
|   ├── app.ts
│   └── server.ts
├── .env
├── .env.example
├── tsconfig.json
└── package.json

Module Architecture

Auth/
     └── auth.controller.ts
     └── auth.service.ts
     └── auth.model.ts
     └── auth.validation.ts
     └── auth.utils.ts
     └── auth.interface.ts
     └── auth.routes.ts

 User/
     └── user.controller.ts
     └── user.service.ts
     └── user.model.ts
     └── user.validation.ts
     └── user.utils.ts
     └── user.interface.ts
     └── user.routes.ts

Modular Architecture

Each feature is isolated in its own module with a clean separation of concerns between controllers, services, and data models.

Type Safety

Built with TypeScript to ensure type safety across your entire application with interface definitions for all models.

Scalable Design

Follows enterprise patterns that allow your application to scale from small projects to large, complex systems.

API Routes

MethodRouteDescriptionAuth Required
POST/api/v1/auth/loginUser loginNo
POST/api/v1/auth/registerUser registrationNo
POST/api/v1/auth/forgot-passwordRequest password resetNo
POST/api/v1/auth/reset-passwordReset passwordNo
POST/api/v1/auth/change-passwordChange passwordYes
GET/api/v1/usersGet all usersYes (Admin)
GET/api/v1/users/profileGet current user profileYes
GET/api/v1/users/:idGet user by IDYes
PATCH/api/v1/users/:idUpdate userYes
DELETE/api/users/:idDelete userYes (Admin)

Key Features

Authentication

Complete JWT authentication with access and refresh tokens, password reset, and account management.

MongoDB Integration

Mongoose ODM setup with models, schemas, and data validation for MongoDB interaction.

Request Validation

Zod schema validation to ensure all API requests match expected data formats and types.

Role-Based Access

User roles and permissions system with middleware for protecting routes based on user roles.

Error Handling

Global error handler with custom error classes and consistent API error responses.

Configuration

Environment-based configuration system for managing different deployment environments.

API Documentation

Swagger UI integration for interactive API documentation and testing endpoints.

Logging

Advanced logging system with request tracking, error logging, and performance monitoring.