Skip to main content
Version: 0.62.0-rc.1266

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, and sqlx-cli.

2. Start Dependencies​

make up-deps

This starts the following Docker services:

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

The reporting data warehouse is not a service: it is a local DuckDB directory rooted at .nix-deps/dw in the worktree (see Data Pipelines).

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

Development URLs​

ServiceURL
Admin Panelhttp://admin.lana-bank.localhost:1355
Admin GraphQL APIhttp://admin.lana-bank.localhost:1355/graphql
Customer GraphQL APIhttp://app.lana-bank.localhost:1355/graphql
Keycloak Admin Consolehttp://localhost:8081
info

GraphQL APIs validate Keycloak JWTs in the Rust servers. The admin panel dev server proxies /graphql to the admin API for same-origin browser requests.

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 Process-Compose​

For an all-in-one foreground stack (dependencies, backend, and admin panel) tied to the invoking shell:

make run-app

For a background stack with a live TUI for logs and restarts:

make up-app tui

Stop the worktree's stack with:

make down-deps

Common Commands​

CommandPurpose
make up-depsStart Nix-managed dependencies
make down-depsStop Nix-managed dependencies
make recreate-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/.

Inspect the DuckDB data warehouse (the read-only serving copy) with the bundled duckdb CLI:

nix develop -c duckdb .nix-deps/dw/serve/lana_dw.duckdb -readonly

The warehouse root contains the Parquet landing zone, the dbt build database, and the published serving copy.

Environment Variables​

The Nix shell automatically sets key environment variables:

VariableValuePurpose
LANA__RUNTIME_DB__PG_CONpostgres://user:password@localhost:5433/pgRuntime database connection
LANA__DW_DB__PATH.nix-deps/dwDuckDB data warehouse root directory
LANA__ENCRYPTION__PROVIDERlocal-static (built-in dev key)Encryption key provider (google-kms in production)
KC_URLhttp://localhost:8081Keycloak URL
REALM(configured per realm)Keycloak realm