Skip to main content
The Aero backend is built with NestJS, a progressive Node.js framework for building efficient and scalable server-side applications. It uses PostgreSQL as the database with Prisma as the ORM.

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

1

Clone and navigate to the API directory

Navigate to the backend source directory:
cd workspace/source/api
2

Install dependencies

Install all required packages using pnpm:
pnpm install
This will install key dependencies including:
  • @nestjs/core and @nestjs/common - NestJS framework
  • @prisma/client - Prisma ORM client
  • jsonwebtoken - JWT authentication
  • argon2 - Password hashing
  • @liaoliaots/nestjs-redis - Redis integration
  • @nestjs/swagger - API documentation
3

Configure environment variables

Create a .env file in the API directory with the required environment variables. See the Configuration page for details.
cp .env.example .env
4

Set up the database

Generate Prisma client and run database migrations:
npx prisma generate
npx prisma migrate deploy
For development, you can also use:
npx prisma migrate dev
5

Start the development server

Run the API in development mode with hot reload:
pnpm run dev
The API will be available at http://localhost:5000

Project structure

The backend follows NestJS modular architecture:
api/
├── prisma/
│   ├── schema.prisma        # Database schema
│   └── migrations/          # Migration files
├── src/
│   ├── resources/           # Feature modules
│   │   ├── auth/           # Authentication
│   │   ├── airports/       # Airport data
│   │   ├── airlines/       # Airline data
│   │   ├── flights/        # Flight search
│   │   └── flight/         # Flight tracking
│   ├── middlewares/        # Global middlewares
│   ├── decorators/         # Custom decorators
│   ├── services/           # Shared services
│   ├── db/                 # Prisma client
│   ├── app.module.ts       # Root module
│   └── main.ts             # Application entry point
└── package.json

Available scripts

The backend includes several npm scripts for development and production:
# Start with watch mode
pnpm run dev

# Start with debug mode
pnpm run start:debug

Compiler configuration

The backend uses SWC for faster compilation. The compiler is configured in nest-cli.json:
{
  "compilerOptions": {
    "builder": {
      "type": "swc",
      "options": {
        "swcrcPath": "./.swcrc"
      }
    },
    "typeCheck": true
  }
}
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
The API uses Swagger/OpenAPI for documentation, with @scalar/nestjs-api-reference providing a modern, interactive interface.

Next steps

After setting up the backend:
  1. Configure your environment variables
  2. Review the database schema
  3. Learn about JWT authentication

Build docs developers (and LLMs) love