Skip to main content

Quick Start

Get up and running with Heimdall in minutes.

Prerequisites​

Before you begin, make sure you have the following installed:

  • Rust (latest stable) - Install Rust
  • Node.js 24+ - Install Node.js
  • pnpm 10+ - npm install -g pnpm
  • Docker - For PostgreSQL, TimescaleDB, Redis, MailDev, MinIO
  • just - Command runner: cargo install just

1. Clone & Setup​

# Clone the repository
git clone https://github.com/smutjebot/heimdall.git
cd heimdall

# Initialize config files
just init

# Install dependencies
pnpm install

2. Start Services​

# Start the dev stack (PostgreSQL, TimescaleDB, Redis, MailDev, MinIO)
just stack-up

# Run database migrations
just migrate

3. Start Development Servers​

Open multiple terminal windows:

# Terminal 1: Start the Rust API
just watch-api

# Terminal 2: Start the admin dashboard
just watch-backend

# Terminal 3: Start the identity service
just watch-id

# Terminal 4: Start the policies site (optional)
just watch-policies

# Terminal 5: Start the documentation (optional)
just watch-docs

4. Verify Installation​

ServiceURLDescription
APIhttp://localhost:3000Rust API server
Swagger UIhttp://localhost:3000/v1/swagger-ui/API documentation
GraphiQLhttp://localhost:3000/v1/graphiqlGraphQL playground
Consolehttp://localhost:3001Admin dashboard
Heimdall IDhttp://localhost:3002Identity service
Docshttp://localhost:3003Documentation
Policieshttp://localhost:3004Legal & privacy policies
PostgreSQLlocalhost:5432Primary database
TimescaleDBlocalhost:5433Time-series GPS data
Redislocalhost:6379Cache & pub/sub
MailDevhttp://localhost:1080Email testing
MinIO S3http://localhost:9000Object storage
MinIO Consolehttp://localhost:9001Object storage console

5. Make Your First Request​

# Check API health
curl http://localhost:3000/health

Returns 200 when every dependency is reachable, 503 otherwise:

{
"status": "healthy",
"version": "2026.7.8",
"timestamp": "2026-07-10T09:12:44.318+00:00",
"uptime": { "days": 0, "hours": 0, "minutes": 3, "seconds": 12, "total": 192.0 },
"services": {
"database": { "status": "up", "responseTime": 2 },
"timescaledb": { "status": "up", "responseTime": 3 },
"redis": { "status": "up", "responseTime": 1 },
"websocket": { "status": "up", "connections": 0, "subscriptions": 0 }
},
"apps": {
"bots": {
"discord_bot": { "status": "up", "responseTime": 4, "uptimeSeconds": 3600 }
}
},
"_links": { "self": "http://localhost:3000/health" }
}

status is healthy or unhealthy. Bot entries are omitted when the bot is not configured.

Development Commands​

Heimdall uses just as a command runner. Run just to see all available commands.

Service Commands​

CommandDescription
just watch-apiRun API with hot reload
just watch-backendRun admin dashboard with hot reload
just watch-idRun identity service with hot reload
just watch-policiesRun policies site with hot reload
just watch-docsRun documentation with hot reload
just watch-dc-botRun Discord bot with hot reload
just watch-tw-botRun Twitch bot with hot reload (scaffold only)
just stack-upStart PostgreSQL, TimescaleDB, Redis, MailDev, MinIO
just stack-downStop dev stack services

Database Commands​

CommandDescription
just migrateRun pending migrations
just migrate-downRollback last migration
just migrate-resetRollback all and re-run migrations
just migrate-statusShow migration status
just db-freshDrop, create, and migrate database

Schema Commands​

CommandDescription
just schemasGenerate OpenAPI and GraphQL schemas
just openapiGenerate OpenAPI spec only
just graphqlGenerate GraphQL schema only
just protoGenerate Protobuf Rust code

Testing Commands​

CommandDescription
just testRun all unit tests
just test-allRun ALL tests (unit + E2E)
just test-quickFast tests only (Rust + shared libs)
just test-apiAPI tests
just test-sharedAll shared library tests
just test-helpShow all test commands

Utility Commands​

CommandDescription
just initCopy example config files
just doctorCheck required tools are installed
just verify-apiFormat, lint, check API
just psqlOpen PostgreSQL shell
just redisOpen Redis shell

Project Structure​

heimdall/
├── platform/
│ ├── api/ # Rust API backend
│ ├── backend/ # Admin dashboard (Next.js)
│ ├── id/ # Identity service (Next.js)
│ ├── docs/ # Documentation (Docusaurus)
│ ├── policies/ # Legal & privacy policies (Next.js)
│ ├── discord_bot/ # Discord bot (Rust/Poise)
│ ├── twitch_bot/ # Twitch bot — scaffold, not implemented
│ ├── youtube_bot/ # YouTube bot — scaffold, not implemented
│ └── proto/ # Shared Protobuf definitions
├── crates/ # 19 heimdall-* Rust crates (migrations live in heimdall-db/migrations)
│ ├── heimdall-api/ # HTTP server assembly
│ ├── heimdall-audit/ # Audit event types
│ ├── heimdall-audit-logger/# Audit logging
│ ├── heimdall-auth/ # Authentication & sessions
│ ├── heimdall-cache/ # Redis caching
│ ├── heimdall-common/ # Shared utilities
│ ├── heimdall-config/ # Configuration loading
│ ├── heimdall-db/ # Database & migrations
│ ├── heimdall-email/ # Email templates & sending
│ ├── heimdall-geoip/ # GeoIP lookups
│ ├── heimdall-graphql/ # GraphQL schema & resolvers
│ ├── heimdall-integrations/# Bot/service integrations
│ ├── heimdall-pegelonline/ # Pegelonline water-level API
│ ├── heimdall-proto/ # Protobuf definitions
│ ├── heimdall-rest/ # REST handlers
│ ├── heimdall-scheduler/ # Background jobs
│ ├── heimdall-storage/ # S3-compatible storage
│ ├── heimdall-telemetry/ # Tracing & metrics
│ └── heimdall-websocket/ # WebSocket (protobuf) server
├── shared/
│ ├── api/ # API client library (@elcto/api)
│ ├── ui/ # UI component library (@elcto/ui)
│ ├── cookies-consent/ # Cookie consent (@elcto/cookies-consent)
│ ├── player/ # Video player (@elcto/player)
│ └── test-utils/ # Test mocks & helpers (@elcto/test-utils)
├── docker/ # Dockerfiles
├── dev-stack/ # Docker Compose for dev
├── justfile # Command runner
├── pnpm-workspace.yaml # pnpm monorepo config
└── Cargo.toml # Rust workspace

Configuration​

API Configuration​

platform/api/config/default.toml ships with the repository — do not edit it for local work. Put machine-specific overrides in platform/api/config/local.toml, which is gitignored and layered on top of the defaults:

[server]
host = "0.0.0.0"
port = 3000

[database]
url = "postgresql://postgres:postgres@localhost:5432/heimdall"

[redis]
url = "redis://localhost:6379"

Any value can also be overridden by environment variable using the double-underscore prefix, e.g. HEIMDALL__SERVER__PORT=3010.

Environment Variables​

The Next.js apps read their configuration from env files. just init creates .env.local for the backend, id, and policies apps from their checked-in .env.example templates, and never overwrites an existing file. To do it by hand:

cp platform/backend/.env.example platform/backend/.env.local
cp platform/id/.env.example platform/id/.env.local
cp platform/policies/.env.example platform/policies/.env.local

The docs site needs no env file.

Docker Deployment​

Build and run with Docker:

# Build the Next.js app images (Dockerfiles live in docker/) — or run `just docker-build`
docker build -f docker/backend.Dockerfile -t heimdall-backend .
docker build -f docker/id.Dockerfile -t heimdall-id .
docker build -f docker/policies.Dockerfile -t heimdall-policies .

# The Rust API and bot images are built via Bazel (rules_img), not Dockerfiles:
# just bazel-push-api
# just bazel-push-discord-bot

# Run containers
docker run -p 3001:3001 heimdall-backend
docker run -p 3002:3002 heimdall-id
docker run -p 3004:3004 heimdall-policies

Next Steps​

Now that you have Heimdall running:

API & Backend​

Shared Libraries​

  • UI Library - 42 React components (Button, Card, Modal, etc.)
  • API Library - REST, GraphQL, WebSocket clients
  • Cookie Consent - GDPR-compliant consent management
  • Video Player - Shaka-based HLS/DASH/CMAF player with DRM and resume support

Bots & Integrations​

Development​