Note
The API is hosted on a free Render tier. Initial requests may experience a delay of up to 1 minute due to "sleep mode" Please wait a little bit for the server to wake up.
A NestJS server for the Event Rave frontend. This project was developed to master authentication flows, strict modular architecture, and modern ORM integration.
- Implementation of dual-token JWT strategy (Access & Refresh) with rotation
- Implement authentication using OAuth 2.0 protocol
- Integration of Prisma ORM with PostgreSQL (Neon DB)
- Following NestJS achitecture for modularity and scalability
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL (via Neon DB)
- ORM: Prisma
- Security: Passport.js, JWT, bcrypt
- API Docs: Swagger (OpenAPI)
The project is divided into specialized modules to ensure high maintainability:
auth/: Core authentication logic (Login/Register)github-auth/: OAuth2 flow for GitHub providertoken/: Logic for generating and rotating Access/Refresh tokensusers/: User profile and data managementevents/: Event CRUD, search, and filteringcategories/: Event categorization managementlikes/: Wishlist logic (managing favorites)database/: Prisma service configurationcommon/: Shared guards, decorators, and global filters
- Access Token: Short-lived, used for authorizing API requests
- Refresh Token: Long-lived, used to obtain new access tokens, saved in DB
- Rotation: Every time a new token is issued, the old refresh token is invalidated to prevent attacks
- GitHub OAuth2: Users can securely authenticate using their GitHub accounts
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/login |
User login |
| POST | /auth/logout |
User logout |
| POST | /auth/refresh |
Refresh tokens |
| GET | /github-auth |
Initiate GitHub OAuth flow |
| GET | /github-auth/oauth/callback |
Callback to get user data |
| GET | /users/me |
Get current user profile |
| POST | /users/register |
Create new user |
| PATCH | /users/:id |
Update user data |
| DELETE | /users/me |
Delete user account |
| GET | /categories |
All categories |
| GET | /categories/:id |
Get category by id |
| GET | /events |
Get events |
| GET | /events/liked |
Get liked events |
| GET | /events/:id |
Get detailed event information |
| PUT | /likes/:eventId/toggle |
Toggle event in wishlist |
For more details, please visit the Swagger UI.
Create a .env file in the root:
DATABASE_URL=postgresql://user:pass@host/db
JWT_ACCESS_SECRET=your_access_secret
JWT_REFRESH_SECRET=your_refresh_secret
GITHUB_CLIENT_ID=your_id
GITHUB_CLIENT_SECRET=your_secret
GITHUB_REDIRECT_URL=your_api_url/github-auth/oauth/callback
FRONTEND_URL=your_frontend_url