Skip to content

Latest commit

 

History

History
223 lines (161 loc) · 5.49 KB

README.md

File metadata and controls

223 lines (161 loc) · 5.49 KB

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