Prerequisites
Before setting up the backend, ensure you have the following installed:- Node.js 20 or higher
- PostgreSQL database
- pnpm package manager (v9.15.1 or higher)
Installation
Install dependencies
Install all required packages using pnpm:This will install key dependencies including:
@nestjs/coreand@nestjs/common- NestJS framework@prisma/client- Prisma ORM clientjsonwebtoken- JWT authenticationargon2- Password hashing@liaoliaots/nestjs-redis- Redis integration@nestjs/swagger- API documentation
Configure environment variables
Create a
.env file in the API directory with the required environment variables. See the Configuration page for details.Set up the database
Generate Prisma client and run database migrations:For development, you can also use:
Project structure
The backend follows NestJS modular architecture:Available scripts
The backend includes several npm scripts for development and production:Compiler configuration
The backend uses SWC for faster compilation. The compiler is configured innest-cli.json:
SWC is significantly faster than the default TypeScript compiler, improving build times during development.
API documentation
Once the server is running, you can access the interactive API documentation at:- Scalar API Reference:
http://localhost:5000/docs
@scalar/nestjs-api-reference providing a modern, interactive interface.
Next steps
After setting up the backend:- Configure your environment variables
- Review the database schema
- Learn about JWT authentication