🚀 Boilerplate Documentation

📦 Features

🔧 Modern Stack

Built with Express.js, Prisma, and TypeScript

🏗️ Modular Architecture

Feature-based modules with controllers and services

🔍 Advanced Queries

Pagination, search, filter, sort, and relation support

🔐 Authentication

JWT-based auth with secure cookie handling

🐳 Docker Ready

Production-ready Docker and Nginx setup

🎯 Type Safety

Full TypeScript support with proper typing

⚡ Quick Start

Installation

git clone <repository-url>
cd prisma-boilerplate
npm install

Environment Setup

Create a .env file in the root directory:

DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
JWT_SECRET="your-secret-key"
PORT=3000

Database Setup

npx prisma generate
npx prisma migrate dev

Running the Application

# Development
npm run dev

# Production
npm run build
npm start

Docker Setup

# Build and run with Docker Compose
docker-compose up --build

🔌 API Endpoints

Authentication

POST /api/v1/auth/register

Register a new user

{
  "email": "user@example.com",
  "password": "password123",
  "name": "John Doe"
}
POST /api/v1/auth/login

Login with credentials

GET /api/v1/auth/me

Get current user profile

Users

GET /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

🛠️ Project Structure

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

🔄 Adding New Modules

1. Create a new directory in src/modules/your-module

2. Create the following files:

3. Register your module in src/config/initControllers.ts

🚀 Advanced Features

Query Builder

All endpoints support advanced query features:

🔒 Security Features

🌟 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.