Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anicmarko9/nest-guard
Nest.js app for JWT Authentiation & RBAC Authorization
https://github.com/anicmarko9/nest-guard
jestjs nestjs nodejs postgres redis typeorm typescript
Last synced: 24 days ago
JSON representation
Nest.js app for JWT Authentiation & RBAC Authorization
- Host: GitHub
- URL: https://github.com/anicmarko9/nest-guard
- Owner: anicmarko9
- Created: 2024-10-05T11:52:25.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-10-17T12:28:58.000Z (about 1 month ago)
- Last Synced: 2024-10-19T15:01:44.072Z (about 1 month ago)
- Topics: jestjs, nestjs, nodejs, postgres, redis, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 1020 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nest.js app for JWT Authentiation & RBAC Authorization
A backend service built with **Nest.js** to handle user registration, login, email verification, organization creation, and user roles using JWT-based authentication and role-based authorization. Features asynchronous email sending with Redis queues.
## Tech Stack
- **TypeScript**
- **Nest.js** with **TypeORM** (PostgreSQL)
- **Bull Queue** (Redis)
- **JWT** Authentication
- **SendGrid** (for emails)
- **Prettier**, **ESLint**, **Jest** (unit & e2e testing)## Features
- **User Registration**: Register with email confirmation via SendGrid.
- **Email Verification**: Verify email to receive a JWT.
- **Login**: Sign in to generate JWT cookie.
- **Organization Management**: Create organizations, invite users, assign roles.
- **Role-based Authorization**: Assign roles and control access to endpoints based on permissions.## Setup Instructions
### 1. Clone the repository
`git clone https://github.com/anicmarko9/nest-guard.git`
### 2. Checkout to the new branch
`git checkout -b features/your-name`
### 3. Install dependencies
`npm ci`
### 4. Start Redis (in a separate terminal)
`sudo service redis-server start`
### 5. Create a PostgreSQL database (if you haven't)
`psql -U postgres -p 5432 -c 'create database nest_guard_db;'`
### 6. Create a SendGrid account
- Sign up at [SendGrid](https://sendgrid.com/) and generate your API key.
### 7. Configure environment variables
- Copy the `.env.example` file and create your own `.env` file in the root directory
### 8. Start development server
`npm run dev`
### 9. Running Tests & Linters
- **typecheck**: `npm run typecheck`
- **eslint**: `npm run ci:format`
- **prettier**: `npm run ci:lint`
- **jest**: `npm run ci:test`
- **build**: `npm run build`