A robust authentication and authorization system built with NestJS, featuring JWT RS256 encryption and secure password handling.
- π 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
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL
- ORM: TypeORM
- Authentication: JWT (RS256)
- Node.js (v16 or higher)
- PostgreSQL
- npm or yarn
- Clone the repository
git clone https://github.com/riteshporiya/nest-auth.git
cd nest-auth
- Install dependencies
npm install
# or
yarn install
- Set up environment variables
cp .env.example .env
Edit the .env
file with your configuration:
- Database credentials
- JWT settings
- Public/Private key paths
- Run migrations
npm run migration:run
# or
yarn migration:run
- Start the application
# Development
npm run start:dev
# or
yarn start:dev
- 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
- 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.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any changes or enhancements you would like to see.
Happy coding! π