Configuration
This guide covers environment configuration for Serko Northsky.
Environment Variables
Backend Configuration
Create a .env file in apps/backend/ with the following variables:
# Database
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/serko_northsky
DATABASE_ECHO=false
# Environment
ENVIRONMENT=local # local, development, testing, production
# Authentication
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY_ID=your-key-id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"
FIREBASE_CLIENT_EMAIL=firebase-adminsdk@your-project.iam.gserviceaccount.com
FIREBASE_CLIENT_ID=your-client-id
# External APIs
QPX_API_URL=https://api.qpx-connect.com
QPX_API_KEY=your-qpx-api-key
BOOKING_COM_API_URL=https://api.booking.com
BOOKING_COM_API_KEY=your-booking-api-key
SABRE_API_URL=https://api.sabre.com
SABRE_CLIENT_ID=your-sabre-client-id
SABRE_CLIENT_SECRET=your-sabre-client-secret
# Observability
LANGFUSE_PUBLIC_KEY=pk-lf-xxx
LANGFUSE_SECRET_KEY=sk-lf-xxx
LANGFUSE_HOST=https://cloud.langfuse.com
Frontend Configuration
Create a .env.local file in apps/frontend/:
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:8000
# Firebase Authentication
NEXT_PUBLIC_FIREBASE_API_KEY=your-api-key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=123456789
NEXT_PUBLIC_FIREBASE_APP_ID=1:123456789:web:abc123
Environment Modes
The backend behaves differently based on the ENVIRONMENT variable:
| Environment | Uncommitted Changes | Logging | Debug |
|---|---|---|---|
local | Raises RuntimeError | Debug | Yes |
development | Raises RuntimeError | Debug | Yes |
testing | Raises RuntimeError | Warning | No |
production | Logs ERROR, continues | Info | No |
Database Configuration
Local Development
For local development, use Docker Compose:
# docker-compose.yml
services:
alloydb:
image: postgres:16
environment:
POSTGRES_USER: serko
POSTGRES_PASSWORD: serko
POSTGRES_DB: serko_northsky
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
Cloud Deployment
For cloud environments, configure AlloyDB connection:
DATABASE_URL=postgresql+asyncpg://user:password@/serko_northsky?host=/cloudsql/project:region:instance
API Keys Setup
QPX Connect
- Request access to QPX Connect API
- Obtain API credentials
- Configure in environment variables
Booking.com
- Register for Booking.com Partner API
- Get your
affiliate_idand API key - Configure endpoints for sandbox/production
Sabre
- Set up Sabre Dev Studio account
- Create application credentials
- Follow the token procedure
Next Steps
- Backend Architecture — Understand the layered architecture
- Unit of Work — Learn about transaction management