Development Environment
This document describes how to set up and use the local development environment.
Prerequisites
- Nix with flakes enabled
- Docker and Docker Compose
- Git
Setup
1. Enter Nix Shell
cd lana-bank
nix develop
2. Start Dependencies
make up-deps
This starts:
- PostgreSQL (port 5433)
- Keycloak (port 8081)
3. Run Migrations
cargo sqlx migrate run
4. Start Application
# Run all servers
cargo run
# Or run the full foreground stack under process-compose
make run-app
Service URLs
| Service | URL |
|---|---|
| Admin Panel | http://admin.lana-bank.localhost:1355 |
| Admin GraphQL | http://admin.lana-bank.localhost:1355/graphql |
| Customer GraphQL | http://app.lana-bank.localhost:1355/graphql |
| Keycloak | http://localhost:8081 |
Process-Compose Development
Foreground development tied to the invoking shell:
# Start dependencies, backend, and admin panel
make run-app
Background development with a TUI for logs and restarts:
# Start dependencies, backend, and admin panel in the background
make up-app
# Attach the TUI to the running background stack
make tui
# Stop this worktree's stack
make down-deps
Database Access
# Connect to PostgreSQL
psql -h localhost -p 5433 -U lana -d lana
# Reset database
make recreate-deps
Frontend Development
# Admin Panel
cd apps/admin-panel
pnpm install
pnpm dev
Environment Variables
# .env.local
DATABASE_URL=postgres://lana:lana@localhost:5433/lana
KEYCLOAK_URL=http://localhost:8081
Keycloak Credentials
| Realm | User | Password |
|---|---|---|
| admin | admin | admin |
| customer | test@test.com | test |
Common Issues
Port Conflicts
# Check what's using a port
lsof -i :5433
# Kill process
kill -9 <PID>
Database Reset
make recreate-deps
cargo sqlx migrate run
Cache Issues
# Clear Rust cache
cargo clean
# Clear pnpm cache
pnpm store prune