Skip to main content
Version: Next

Local Development Setup

This guide walks you through setting up a local development environment for lana-bank.

Prerequisites

  • Nix with flakes enabled
  • Docker and Docker Compose

Quick Start

1. Enter the Nix Shell

nix develop

This provides a reproducible shell with all required tools: Rust stable toolchain, Node.js 20, pnpm 10, Python 3.13, PostgreSQL client tools, sqlx-cli, and Tilt.

2. Start Dependencies

make start-deps

This starts the following Docker services:

ServicePortPurpose
core-pg (PostgreSQL)5433Main application database
keycloak8081Identity provider (OIDC)
keycloak-pg5437Keycloak database
oathkeeper4455API gateway (JWT validation)
otel-agent4317, 4318OpenTelemetry collector

To include Dagster (data pipelines):

DAGSTER=true make start-deps

3. Run the Backend

make setup-db run-server

This runs database migrations and starts the Rust application server.

4. Run Frontend Apps

In separate terminals:

# Admin Panel
cd apps/admin-panel && pnpm dev

# Customer Portal
cd apps/customer-portal && pnpm dev

Development URLs

ServiceURL
Admin Panelhttp://admin.localhost:4455
Customer Portalhttp://app.localhost:4455
Admin GraphQL APIhttp://admin.localhost:4455/graphql
Customer GraphQL APIhttp://app.localhost:4455/graphql
Keycloak Admin Consolehttp://localhost:8081
info

GraphQL APIs must be accessed through Oathkeeper (port 4455) which handles JWT validation. Direct ports (5253/5254) lack authentication context and will not work properly.

tip

If app.localhost doesn't resolve, add 127.0.0.1 app.localhost and ::1 app.localhost to your /etc/hosts file.

Interactive Development with Tilt

For hot-reloading of all services:

make dev-up

Tilt orchestrates Docker services + local app processes with live reload. Stop with:

make dev-down

Common Commands

CommandPurpose
make start-depsStart Docker dependencies
make stop-depsStop Docker dependencies
make reset-depsClean and restart databases
make check-code-rustVerify Rust code compiles
make check-code-appsLint, type-check, and build frontends
cargo nextest runRun all Rust tests
cargo nextest run -p <crate>Run tests for a single crate
make e2eRun BATS end-to-end tests
make sdlRegenerate GraphQL schemas
make sqlx-prepareUpdate SQLx offline query cache
warning

Prefix direct cargo commands with SQLX_OFFLINE=true to use the offline query cache instead of requiring a running database.

Database Access

Connect to the main PostgreSQL database:

psql postgres://user:password@localhost:5433/pg

Run migrations manually:

cargo sqlx migrate run

Migrations are located in lana/app/migrations/.

Environment Variables

The Nix shell automatically sets key environment variables:

VariableValuePurpose
PG_CONpostgres://user:password@localhost:5433/pgDatabase connection
ENCRYPTION_KEY(dev key)Encryption key for secrets
KC_URLhttp://localhost:8081Keycloak URL
REALM(configured per realm)Keycloak realm