Built with Express.js, Prisma, and TypeScript
Feature-based modules with controllers and services
Pagination, search, filter, sort, and relation support
JWT-based auth with secure cookie handling
Production-ready Docker and Nginx setup
Full TypeScript support with proper typing
git clone <repository-url>
cd prisma-boilerplate
npm install
Create a .env file in the root directory:
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
JWT_SECRET="your-secret-key"
PORT=3000
npx prisma generate
npx prisma migrate dev
# Development
npm run dev
# Production
npm run build
npm start
# Build and run with Docker Compose
docker-compose up --build
/api/v1/auth/register
Register a new user
{
"email": "user@example.com",
"password": "password123",
"name": "John Doe"
}
/api/v1/auth/login
Login with credentials
/api/v1/auth/me
Get current user profile
/api/v1/users
Get users with advanced query support:
# Pagination
?page=1&limit=10
# Search
?search=john
# Filter
?filter[role]=admin
# Sort
?sort=createdAt:desc
# Select Fields
?fields=id,name,email
# Include Relations
?include=posts,comments
src/
├── app.ts # Main application class
├── server.ts # Server entry point
├── config/ # Configuration
├── db/ # Database setup
├── modules/ # Feature modules
│ ├── auth/ # Authentication module
│ ├── user/ # User module
│ └── example/ # Example module
├── routes/ # Route definitions
├── sockets/ # (removed)
└── utils/ # Utilities
1. Create a new directory in src/modules/your-module
2. Create the following files:
your-module.model.ts - Prisma model definitionyour-module.routes.ts - Route definitionsYourModuleController.ts - Controller logicYourModuleService.ts - Business logic
3. Register your module in src/config/initControllers.ts
All endpoints support advanced query features:
Contributions are welcome! Please feel free to submit a Pull Request.