Skip to content
/ prime-nestjs Public template

Production-ready NestJS boilerplate featuring JWT authentication, TypeORM, RBAC, Swagger, and Docker support. Built for enterprise-grade Node.js applications

License

Notifications You must be signed in to change notification settings

josephgoksu/prime-nestjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Prime NestJS

prime-nestjs

License: MIT Known Vulnerabilities GitHub last commit GitHub stars

Description

Production-ready NestJS starter kit with enterprise-grade features for building scalable applications.

Features

  • πŸ” JWT Authentication (RSA256) with Role-Based Access Control
  • πŸ—„οΈ PostgreSQL + TypeORM with migration support
  • πŸ“š Swagger API Documentation auto-generated at /api
  • 🐳 Docker ready with compose configuration
  • πŸ§ͺ Testing setup with Jest (unit & e2e)
  • πŸ”§ Developer Experience with ESLint, Prettier, Husky
  • πŸ›‘οΈ Security with Helmet, CORS, rate limiting
  • πŸ“Š Monitoring ready with built-in health checks

Quick Start

Prerequisites

  • Node.js >= 20.0.0
  • PostgreSQL (or use Docker)

Setup

# Clone repository
git clone https://github.com/josephgoksu/prime-nestjs.git
cd prime-nestjs

# Install dependencies
npm install

# Setup environment
cp .env.example .env

# Start with Docker (recommended)
npm run docker:up

# OR start locally
npm run start:dev

The API will be available at http://localhost:3000

Development

Available Scripts

npm run start:dev     # Development with hot-reload
npm run build         # Build for production
npm run start:prod    # Run production build
npm run test          # Run unit tests
npm run test:e2e      # Run e2e tests
npm run test:cov      # Generate coverage report
npm run lint          # Lint and fix code
npm run format        # Format code with Prettier

Database

npm run schema:sync              # Sync database schema (dev only)
npm run migration:generate       # Generate migration from changes
npm run migration:run            # Apply pending migrations
npm run migration:revert         # Revert last migration

Docker

npm run docker:build   # Build containers
npm run docker:up      # Start all services
npm run docker:down    # Stop all services

Project Structure

src/
β”œβ”€β”€ auth/           # JWT authentication & guards
β”œβ”€β”€ config/         # App configuration
β”œβ”€β”€ tasks/          # Task management feature
β”œβ”€β”€ users/          # User management
└── main.ts         # Application entry

Environment Variables

# Database
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=mysecretpassword
POSTGRES_DB=postgres

# App
PORT=3000
NODE_ENV=development

# Auth (generate your own keys - see Security section)
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----..."
PUBLIC_KEY="-----BEGIN PUBLIC KEY-----..."

Security

Generate RSA Keys

# Generate private key
openssl genrsa -out private_key.pem 2048

# Extract public key
openssl rsa -in private_key.pem -pubout -out public_key.pem

# Format for .env (single line)
awk 'NF {sub(/\r/, ""); printf"%s\\n",$0;}' private_key.pem
awk 'NF {sub(/\r/, ""); printf"%s\\n",$0;}' public_key.pem

API Documentation

  • Swagger UI: http://localhost:3000/api
  • Import to Insomnia: Use endpoints.json

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'feat: add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

License

MIT Β© Joseph Goksu

Star History

Star History Chart

About

Production-ready NestJS boilerplate featuring JWT authentication, TypeORM, RBAC, Swagger, and Docker support. Built for enterprise-grade Node.js applications

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •