Skip to content

Latest commit

Β 

History

History
98 lines (74 loc) Β· 2.25 KB

README.md

File metadata and controls

98 lines (74 loc) Β· 2.25 KB

πŸ” nest-auth

A robust authentication and authorization system built with NestJS, featuring JWT RS256 encryption and secure password handling.

✨ Features

  • πŸ”’ Complete authentication system
  • πŸ‘€ User management APIs
  • πŸ”‘ JWT RS256 encryption using public/private key pairs
  • πŸ›‘οΈ Secure password encryption with public/private keys
  • 🚫 Role-based authorization
  • πŸ“ TypeScript support
  • 🎯 Clean architecture and best practices

πŸ› οΈ Tech Stack

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • PostgreSQL
  • npm or yarn

Installation

  1. Clone the repository
git clone https://github.com/riteshporiya/nest-auth.git
cd nest-auth
  1. Install dependencies
npm install
# or
yarn install
  1. Set up environment variables
cp .env.example .env

Edit the .env file with your configuration:

  • Database credentials
  • JWT settings
  • Public/Private key paths
  1. Run migrations
npm run migration:run
# or
yarn migration:run
  1. Start the application
# Development
npm run start:dev
# or
yarn start:dev

πŸ”Œ API Endpoints

πŸ”’ Security Features

  • JWT RS256 encryption for enhanced security
  • Public/Private key encryption for passwords
  • Role-based access control
  • Protected routes with custom guards
  • Request validation
  • Rate limiting

πŸ—οΈ Architecture

  • Custom Decorator: Uses a custom decorator to set rate limit metadata on routes.
  • Interceptor: Implements an interceptor to set custom logs.
  • Dependency Injection: Uses NestJS's dependency injection system and module structure.
  • Reflector: Utilizes the Reflector to access metadata.
  • HttpException: Throws a standard HttpException for rate limit errors.

πŸ“„ License

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

🀝 Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes or enhancements you would like to see.

Happy coding! πŸŽ‰