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 20+ - Install Node.js
- pnpm -
npm install -g pnpm - Docker - For PostgreSQL and Redis
- 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, Redis, MailDev)
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
| Service | URL | Description |
|---|---|---|
| API | http://localhost:3000 | Rust API server |
| Swagger UI | http://localhost:3000/v1/swagger-ui/ | API documentation |
| GraphiQL | http://localhost:3000/v1/graphiql | GraphQL playground |
| Console | http://localhost:3001 | Admin dashboard |
| Heimdall ID | http://localhost:3002 | Identity service |
| Docs | http://localhost:3003 | Documentation |
| Policies | http://localhost:3004 | Legal & privacy policies |
| MailDev | http://localhost:1080 | Email testing |
5. Make Your First Request
# Check API health
curl http://localhost:3000/health
# Response: {"status":"ok","version":"2025.12.1"}
Development Commands
Heimdall uses just as a command runner. Run just to see all available commands.
Service Commands
| Command | Description |
|---|---|
just watch-api | Run API with hot reload |
just watch-backend | Run admin dashboard with hot reload |
just watch-id | Run identity service with hot reload |
just watch-policies | Run policies site with hot reload |
just watch-docs | Run documentation with hot reload |
just watch-discord-bot | Run Discord bot with hot reload |
just watch-twitch-bot | Run Twitch bot with hot reload |
just stack-up | Start PostgreSQL, Redis, MailDev |
just stack-down | Stop dev stack services |
Database Commands
| Command | Description |
|---|---|
just migrate | Run pending migrations |
just migrate-down | Rollback last migration |
just migrate-reset | Rollback all and re-run migrations |
just migrate-status | Show migration status |
just db-fresh | Drop, create, and migrate database |
Schema Commands
| Command | Description |
|---|---|
just schemas | Generate OpenAPI and GraphQL schemas |
just generate-openapi | Generate OpenAPI spec only |
just generate-schema | Generate GraphQL schema only |
just proto | Generate Protobuf Rust code |
Testing Commands
| Command | Description |
|---|---|
just test | Run all unit tests |
just test-all | Run ALL tests (unit + E2E) |
just test-quick | Fast tests only (Rust + shared libs) |
just test-api | API tests |
just test-shared | All shared library tests |
just test-help | Show all test commands |
Utility Commands
| Command | Description |
|---|---|
just init | Copy example config files |
just doctor | Check required tools are installed |
just verify-api | Format, lint, check API |
just psql | Open PostgreSQL shell |
just redis | Open 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 (Rust)
│ ├── migrations/ # Database migrations
│ └── proto/ # Shared Protobuf definitions
├── crates/
│ ├── audit/ # Shared audit event types (heimdall-audit)
│ ├── proto/ # Protobuf definitions (heimdall-proto)
│ └── storage/ # S3-compatible storage (heimdall-storage)
├── 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)
├── docker/ # Dockerfiles
├── dev-stack/ # Docker Compose for dev
├── justfile # Command runner
├── pnpm-workspace.yaml # pnpm monorepo config
└── Cargo.toml # Rust workspace
Configuration
API Configuration
Copy the example config and adjust as needed:
cp platform/api/config/default.toml.example platform/api/config/default.toml
Key configuration options:
[server]
host = "0.0.0.0"
port = 3000
[database]
url = "postgresql://postgres:postgres@localhost:5432/heimdall"
[redis]
url = "redis://localhost:6379"
Environment Variables
Each Next.js app requires environment variables. Copy the examples:
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
cp platform/docs/.env.example platform/docs/.env.local
Docker Deployment
Build and run with Docker:
# Build images
docker build -f docker/api.Dockerfile -t heimdall-api .
docker build -f docker/backend.Dockerfile -t heimdall-backend .
docker build -f docker/id.Dockerfile -t heimdall-id .
docker build -f docker/docs.Dockerfile -t heimdall-docs .
docker build -f docker/policies.Dockerfile -t heimdall-policies .
# Run containers
docker run -p 3000:3000 heimdall-api
docker run -p 3001:3001 heimdall-backend
docker run -p 3002:3002 heimdall-id
docker run -p 3003:3003 heimdall-docs
docker run -p 3004:3004 heimdall-policies
Next Steps
Now that you have Heimdall running:
API & Backend
- API Overview - Learn about all available APIs
- Authentication - Set up authentication
- REST API Reference - Complete REST endpoint reference
- GraphQL Guide - Learn to use the GraphQL API
- WebSocket Guide - Real-time communication
- Storage API - S3-compatible file storage
Shared Libraries
- UI Library - 25+ React components (Button, Card, Modal, etc.)
- API Library - REST, GraphQL, WebSocket clients
- Cookie Consent - GDPR-compliant consent management
- Video Player - HLS/DASH/MP4 player with resume support
Bots & Integrations
- Discord Bot - Discord bot development guide
- Code Examples - Integration examples in multiple languages
Development
- Testing Guide - Testing commands and best practices
- Architecture - System architecture overview