Skip to main content

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:

EnvironmentUncommitted ChangesLoggingDebug
localRaises RuntimeErrorDebugYes
developmentRaises RuntimeErrorDebugYes
testingRaises RuntimeErrorWarningNo
productionLogs ERROR, continuesInfoNo

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

  1. Request access to QPX Connect API
  2. Obtain API credentials
  3. Configure in environment variables

Booking.com

  1. Register for Booking.com Partner API
  2. Get your affiliate_id and API key
  3. Configure endpoints for sandbox/production

Sabre

  1. Set up Sabre Dev Studio account
  2. Create application credentials
  3. Follow the token procedure

Next Steps