This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Fedimint Observer is a Rust-based monitoring platform for Fedimint federations, aiming to be "the mempool.space for Fedimint". It provides transparency into federation operations while respecting privacy constraints.
# Enter development environment (requires Nix)
nix develop
# Start local PostgreSQL for development
just pg_start
# Run backend server with auto-reload
just watch
# Run frontend with hot-reload (in separate terminal)
just serve_frontend
# Check code compilation and common issues (preferred during development)
just clippy
# Run all tests
just test
# Format code
just format
# Run all checks before PR
just final-checkjust build # Build everything
just build_package fmo_server
just build_package fmo_frontend --target wasm32-unknown-unknownjust clippy # Run clippy linter (preferred for quick compilation checks)
just clippy-fix # Run clippy with auto-fix
just check # Run cargo check
just lint # Run pre-commit linting
just typos # Check for typos
just typos-fix-all # Fix all typosjust pg_start # Start local PostgreSQL
just pg_stop # Stop PostgreSQL
just pg_backup # Backup database
just pg_restore BACKUP_FILEjust test_package fmo_server
just test_package fmo_frontend --target wasm32-unknown-unknownfmo_api_types/- Shared API types between frontend and backendfmo_server/- Backend server (Axum + PostgreSQL)/config/*endpoints - Federation configuration API (stable)/federations/*endpoints - Federation monitoring API (unstable)- Background tasks for monitoring federations and syncing data
fmo_frontend/- Frontend PWA (Leptos + WASM + Tailwind CSS)- Component-based architecture with reactive state management
- Client-side routing with Leptos Router
- Shared Types: All API types are defined in
fmo_api_typesand used by both frontend and backend - Database Migrations: Version-controlled SQL migrations in
fmo_server/schema/(v0-v8) - Background Monitoring:
FederationObserverspawns tasks to monitor multiple federations concurrently - State Management:
- Backend: Shared app state with Arc/RwLock for thread safety
- Frontend: Leptos signals and resources for reactive updates
- Error Handling: Custom
AppErrortype wrappinganyhow::Errorfor consistent error propagation
Required environment variables (see sample.env):
FO_BIND: Server bind address (e.g., "127.0.0.1:3000")FO_DATABASE: PostgreSQL connection stringFO_ADMIN_AUTH: Admin authentication passwordFO_MEMPOOL_URL: Mempool API URL (default: "https://mempool.space/api")ALLOW_CONFIG_CORS: Enable CORS for config endpoints
- Config API (
/config/*): Stable API for federation configuration inspection - Federations API (
/federations/*): Unstable API for federation monitoring data - Admin endpoints: Require bearer token authentication via
FO_ADMIN_AUTH
The frontend uses Leptos with WASM compilation. Components are organized by feature:
src/components/federations/- Federation list viewssrc/components/federation/- Single federation detailssrc/components/nostr/- Nostr integration views
Use just serve_frontend for hot-reload development with Trunk.
PostgreSQL with materialized views and complex indexes. Key tables:
federations- Federation configurationssessions- Consensus sessionstransactions- Transaction recordsguardian_health_*- Guardian monitoring datanostr_*- Nostr protocol integration