Mock Alpha

Configuration

Environment variables and configuration reference for Mock Alpha

Configuration

This page applies when you self-host Mock Alpha. All configuration is done via environment variables in .env.local (or the environment of your deployment).

Required variables

VariableDescription
DATABASE_URLPostgreSQL connection string
NEXTAUTH_URLFull URL of the dashboard (e.g., http://localhost:3000)
NEXTAUTH_SECRETRandom secret for signing session tokens — use openssl rand -base64 32

Optional variables

VariableDefaultDescription
MQTT_TCP_PORT1883TCP port for the MQTT broker
MQTT_WS_PORT1884WebSocket port for the MQTT broker
MQTT_ENABLEDtrueSet to false to disable the MQTT broker entirely

Example .env.local

# Database
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/mockalpha

# Auth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-here

# MQTT (optional)
MQTT_TCP_PORT=1883
MQTT_WS_PORT=1884

Database setup

Mock Alpha uses Drizzle ORM with PostgreSQL. Run migrations before first use:

npm run db:migrate

To open Drizzle Studio (visual DB browser):

npm run db:studio

Docker Compose

The included docker-compose.yml provides a PostgreSQL service:

services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: mockalpha
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

Start it with:

# from the repo root
docker compose up -d postgres

Production deployment

See Self-Hosting for the full deployment checklist (public URL, HTTPS, managed PostgreSQL, MQTT ports).

API key rotation

Each project has one API key. To rotate it:

  1. Go to Project Settings
  2. Click Regenerate API Key
  3. Update the key wherever your clients store it (e.g., Android local.properties, web .env, CI secrets)

Old requests using the previous key will be rejected immediately.

On this page