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
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
NEXTAUTH_URL | Full URL of the dashboard (e.g., http://localhost:3000) |
NEXTAUTH_SECRET | Random secret for signing session tokens — use openssl rand -base64 32 |
Optional variables
| Variable | Default | Description |
|---|---|---|
MQTT_TCP_PORT | 1883 | TCP port for the MQTT broker |
MQTT_WS_PORT | 1884 | WebSocket port for the MQTT broker |
MQTT_ENABLED | true | Set 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=1884Database setup
Mock Alpha uses Drizzle ORM with PostgreSQL. Run migrations before first use:
npm run db:migrateTo open Drizzle Studio (visual DB browser):
npm run db:studioDocker 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/dataStart it with:
# from the repo root
docker compose up -d postgresProduction 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:
- Go to Project Settings
- Click Regenerate API Key
- 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.