Production-ready NestJS backend with Prisma ORM, PostgreSQL, and Docker
- Backend: NestJS, TypeScript
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT + Refresh Tokens (planned)
- Validation: Zod + Class Validator
- Documentation: Swagger/OpenAPI
- Infrastructure: Docker, Azure App Service (planned)
- Testing: Jest + Supertest
src/
├── common/ # Shared utilities
│ ├── decorators/ # Custom decorators
│ ├── guards/ # Auth guards
│ ├── interceptors/ # Request/response interceptors
│ ├── filters/ # Exception filters
│ └── dtos/ # Shared DTOs
├── auth/ # Authentication module
│ ├── dto/ # Auth DTOs
│ └── strategies/ # Passport strategies
├── users/ # User management
├── projects/ # Project CRUD
├── health/ # Health check endpoint
├── prisma/ # Database service
└── config/ # Environment configuration
- Node.js 18+
- Docker & Docker Compose
- npm or yarn
-
Clone and install dependencies
git clone <repository-url> cd drobytech-api-core npm install
-
Environment configuration
cp .env.example .env # Edit .env with your configuration -
Start PostgreSQL database
docker-compose up -d
-
Database setup
# Generate Prisma client npm run prisma:generate # Run migrations npm run prisma:migrate # Seed database with sample data npm run prisma:seed
-
Start development server
npm run start:dev
# Development
npm run start:dev # Start with hot reload
npm run start:debug # Start with debugger
# Database
npm run prisma:generate # Generate Prisma client
npm run prisma:migrate # Run database migrations
npm run prisma:seed # Seed database
npm run prisma:studio # Open Prisma Studio
# Testing
npm run test # Unit tests
npm run test:e2e # End-to-end tests
npm run test:cov # Test coverage
# Production
npm run build # Build for production
npm run start:prod # Start production server- Health Check:
GET /api/health - API Documentation:
GET /docs(Swagger UI) - Authentication:
POST /api/auth/*(planned) - Users:
GET|POST|PUT|DELETE /api/users/*(planned) - Projects:
GET|POST|PUT|DELETE /api/projects/*(planned)
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3000 |
DATABASE_URL |
PostgreSQL connection string | Required |
JWT_ACCESS_SECRET |
JWT access token secret | Required |
JWT_REFRESH_SECRET |
JWT refresh token secret | Required |
JWT_ACCESS_TTL |
Access token TTL | 15m |
JWT_REFRESH_TTL |
Refresh token TTL | 7d |
NODE_ENV |
Environment | development |
CORS_ORIGINS |
Allowed CORS origins | https://drobytech.com,https://www.drobytech.com,http://localhost:3000 |
model User {
id String @id @default(cuid())
email String @unique
password String
name String?
role Role @default(USER)
projects Project[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}model Project {
id String @id @default(cuid())
title String
description String?
ownerId String
owner User @relation(fields: [ownerId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}# Run all tests
npm run test
# Run E2E tests
npm run test:e2e
# Run with coverage
npm run test:covThis project is designed for deployment on Azure App Service with PostgreSQL. See the deployment documentation for detailed instructions.
- API Documentation: Available at
/docswhen running locally - Portfolio: DrobyTech Tech Lab
- NestJS Docs: Official Documentation
This is a personal portfolio project. For questions or suggestions, please reach out via the contact information on DrobyTech.
This project is part of the DrobyTech portfolio and is for demonstration purposes.