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 start-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 interactive stack under process-compose
make dev-deps-and-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
Interactive development with a TUI for logs and restarts:
# Start dependencies, backend, and admin panel
make dev-deps-and-app
# Or attach the TUI to an already-running background stack
make process-compose-tui
# Stop this worktree's stack
make dev-down
Database Access
# Connect to PostgreSQL
psql -h localhost -p 5433 -U lana -d lana
# Reset database
make reset-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 reset-deps
cargo sqlx migrate run
Cache Issues
# Clear Rust cache
cargo clean
# Clear pnpm cache
pnpm store prune