Local Development
TL;DR – keep
config.tomlin sync with your environment, usejust devfor paired watchers, and rely on the CLI for quick smoke tests of authentication and streaming.
Environment configuration
All binaries load configuration through rustygpt-shared::config::server::Config. The loader merges:
- Built-in defaults selected by the active profile (Dev/Test/Prod)
- Optional
config.toml/config.yaml/config.json - Environment variables such as
RUSTYGPT__SERVER__PORT=9000 - CLI overrides (e.g.
cargo run -p rustygpt-server -- serve --port 9000)
Keep secrets out of the repo—override them with environment variables or a private config.toml. See
Configuration for the full key list.
Watcher workflows
The Justfile orchestrates the common flows:
# Run server + web watchers together (uses rustygpt-tools/confuse)
just dev
# Backend only hot-reload
just watch-server
# Run fmt, check, and clippy
just check
just dev spawns two subprocesses:
rustygpt-serverviacargo watch -x 'run -- serve --port 8080'rustygpt-webviatrunk watch
Logs stream to stdout so you can confirm when migrations finish (db_bootstrap_* metrics) and when the SSE hub accepts
connections.
CLI smoke tests
The CLI binary lives at rustygpt-cli. Useful commands while iterating:
# Launch the server directly from the CLI crate
cargo run -p rustygpt-cli -- serve --port 8080
# Generate the OpenAPI spec
cargo run -p rustygpt-cli -- spec openapi.yaml
# Generate config skeletons
cargo run -p rustygpt-cli -- config --format toml
# Manage sessions
cargo run -p rustygpt-cli -- login
cargo run -p rustygpt-cli -- me
cargo run -p rustygpt-cli -- logout
CLI commands reuse the same cookie jar as the web client. Cookies are stored under ~/.config/rustygpt/session.cookies by
default (see [cli] in the configuration schema).
Debugging tips
- Enable verbose tracing:
RUST_LOG=rustygpt_server=debug,tower_http=info just run-server - Inspect SSE payloads:
curl -N http://127.0.0.1:8080/api/stream/conversations/<conversation-id>(requires an authenticated session andfeatures.sse_v1 = true) - Verify configuration resolution:
cargo run -p rustygpt-cli -- config --format jsonand inspect the generated file - Regenerate database bindings or seed data by restarting the server; bootstrap scripts rerun automatically when the process starts
- Use
docker compose logs postgresif migrations fail during bootstrap
For operational playbooks (e.g. Docker deployment or rotating secrets) see the How-to section.