Production-ready REST API starter template built with Node.js, Express, and TypeScript. Features JWT authentication, PostgreSQL with Prisma ORM, Docker support, CI/CD pipeline, and best practices for scalable backend development.
Perfect for quickly bootstrapping new Node.js projects with enterprise-grade architecture.
- π Quick Start - Bootstrap your API in minutes
- π Secure - JWT auth, helmet, rate limiting, input validation
- π³ Docker Ready - Containerize with Docker & Docker Compose
- β Well Tested - Jest unit & integration tests
- π Documented - Swagger/OpenAPI docs out of the box
- π§ Production Ready - Winston logging, error handling, graceful shutdown
- πΌ Best Practices - Clean architecture, DI, code linting
- Runtime: Node.js 20.x
- Framework: Express.js 5.x
- Language: TypeScript (strict mode)
- Database: PostgreSQL 14+ with Prisma ORM 7.x
- Authentication: JWT (access + refresh tokens)
- Validation: Zod
- Dependency Injection: Inversify
- Testing: Jest with ts-jest
- Logging: Winston with file rotation
- API Docs: Swagger/OpenAPI
# Clone the repo
git clone https://github.com/kumarsonu676/node-express-prisma-starter-rest-api.git
cd node-express-prisma-starter-rest-api
# Start with Docker
docker-compose up --build# Clone and install
git clone https://github.com/kumarsonu676/node-express-prisma-starter-rest-api.git
cd node-express-prisma-starter-rest-api
npm install
# Setup environment
cp .env.example .env
# Start PostgreSQL with Docker
docker run -d -p 5432:5432 -e POSTGRES_USER=app -e POSTGRES_PASSWORD=password -e POSTGRES_DB=app postgres:14
# Generate client & run migrations
npm run generate_prisma_client
npm run update_database
# Start development server
npm run devServer runs on http://localhost:3001
- JWT access + refresh token authentication
- Role-based access control (RBAC)
- Secure password hashing with bcrypt
- RESTful API design
- Prisma ORM with PostgreSQL
- Input validation with Zod
- Swagger documentation at
/api/docs
- Helmet.js for HTTP headers
- Rate limiting
- CORS configuration
- Request ID tracking
- Hot reload with nodemon
- TypeScript strict mode
- Prettier code formatting
- Commit message linting
- Git hooks with Husky
- Winston logging with rotation
- Global error handling
- Graceful shutdown
- Docker multi-stage build
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Compile TypeScript |
npm run start |
Start production server |
npm run test |
Run all tests |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Run tests with coverage |
npm run format |
Format code with Prettier |
npm run lint |
Check code formatting |
src/
βββ config/ # App configuration, IoC container
βββ integrations/ # External services
β βββ notification/ # Email (SMTP)
β βββ payment/ # Stripe
β βββ upload/ # Azure Blob Storage
βββ middleware/ # Express middleware
β βββ auth.middleware.ts
β βββ error.middleware.ts
β βββ validate.middleware.ts
β βββ ...
βββ modules/ # Feature modules
β βββ {module}/
β βββ {module}.controller.ts
β βββ {module}.service.ts
β βββ {module}.repository.ts
β βββ {module}.routes.ts
β βββ {module}.types.ts
β βββ {module}.validation.ts
βββ routes/ # Route registration
βββ services/ # Shared services
βββ tests/ # Test files
βββ types/ # Global types
βββ utils/ # Utilities
βββ app.ts # Express app setup
Swagger docs available at: http://localhost:3001/api/docs
Include tokens in Authorization header:
Authorization: Bearer <access_token>
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human readable message"
}
}Contributions are welcome! Please read CONTRIBUTING.md for details.
ISC License - see LICENSE for details.