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

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Prime NestJS Boilerplate

prime-nestjs

Status

License: MIT Known Vulnerabilities Maintenance GitHub last commit

Project Stats

GitHub issues GitHub stars GitHub contributors GitHub package.json version GitHub GitHub GitHub GitHub

Repository Activity

GitHub GitHub GitHub GitHub

πŸ“– Description

Enterprise-grade NestJS starter kit with battle-tested architecture and security-first design. Built for teams who need a robust foundation for scalable Node.js applications with:

Key Features

  • πŸ“± NestJS β€” Latest version with TypeScript support
  • πŸ” Security
    • JWT Authentication with RSA256
    • Role-Based Access Control (RBAC)
    • Claims-Based Access Control (CBAC)
    • Helmet for secure HTTP headers
  • πŸͺ Database
    • PostgreSQL with TypeORM
    • Migration support
    • Database schema synchronization
  • πŸ›  Development Tools
    • Docker Compose setup
    • Environment configuration with Dotenv
    • Swagger API documentation
    • ESLint & Prettier configuration
    • Conventional commit linting
    • CodeQL security scanning
    • Jest testing framework
  • πŸ“š Documentation
    • Swagger UI
    • Insomnia API collection

πŸ— Project Structure

src/
β”œβ”€β”€ auth/           # Authentication & authorization
β”œβ”€β”€ config/         # Configuration modules
β”œβ”€β”€ logger/         # Custom logging functionality
β”œβ”€β”€ tasks/          # Task management module
β”œβ”€β”€ users/          # User management module
β”œβ”€β”€ app.module.ts   # Main application module
└── main.ts         # Application entry point

πŸš€ Getting Started

Prerequisites

  • Node.js >= 20.0.0
  • npm >= 10.0.0
  • PostgreSQL
  • Docker (optional)

Quick Setup (Production)

bash ./setup.sh

Development Setup

  1. Install dependencies:
npm install
  1. Copy environment file:
cp .env.example .env
  1. Configure your environment variables in .env

Running the Application

# Development mode
npm run start

# Watch mode with hot-reload
npm run start:dev

# Production mode
npm run start:prod

Database Management

# Sync database schema
npm run schema:sync

# Generate migration
npm run add:migration [MigrationName]

# Apply migrations
npm run apply:migration

# Revert last migration
npm run revert:migration

Docker Support

# Build containers
npm run docker:build

# Start services
npm run docker:up

# Stop services
npm run docker:down

Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Test coverage
npm run test:cov

πŸ”’ Security Setup

SSL Certificate Generation

1. Generate RSA Private Key

openssl genrsa -out private_key.pem 2048

# Format key for environment variable
awk 'NF {sub(/\r/, ""); printf"%s\\n",$0;}' private_key.pem

2. Extract Public Key

openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem

# Format key for environment variable
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' public_key.pem

πŸ“ API Documentation

Swagger UI

Access the Swagger documentation at /api when running the application.

Insomnia Collection

  1. Install Insomnia
  2. Import the endpoints.json file
  3. Start exploring the APIs

🀝 Contributing

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributors


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

  •  
  •  
  •