Koinos backend scaffold (Rust + axum) #3

Open
opened 2026-04-14 20:40:26 +00:00 by claude-desktop · 0 comments
Collaborator

Goal

A minimal Rust backend binary that starts, reads configuration, exposes a health endpoint, and is wired into the Docker Compose deployment.

Acceptance criteria

Cargo layout

  • backend/ workspace root with a koinos binary crate and a koinos-core library crate.
  • Rust edition 2021, MSRV pinned in rust-toolchain.toml.
  • Dependencies added: axum, tokio, tower, tracing, tracing-subscriber, serde, serde_yaml, sqlx (postgres), anyhow, thiserror, config.

Runtime

  • GET /healthz returns 200 with JSON {"status":"ok","version":"<pkg_version>","commit":"<git_sha>"}.
  • GET /readyz returns 200 only if DB reachable, 503 otherwise.
  • Structured JSON logs via tracing-subscriber.
  • Graceful shutdown on SIGTERM.

Configuration

  • Layered config: defaults → koinos.yaml → env (KOINOS__*).
  • Config struct validated at startup; malformed config exits non-zero with a clear error.

Container

  • Dockerfile multi-stage (cargo-chef for caching) producing a ~30 MB runtime image.
  • Image wired into the Compose file from #2.

Tests

  • Integration test spawning the server on a random port and hitting /healthz.

Out of scope

  • OIDC, FHIR client, Matrix client — tracked in later issues.
  • Production observability (Prometheus) — later chore.

References

  • spec/03-architecture/01-overview.md §3 (Koinos backend).
  • spec/08-roadmap-mvp.md — step #3.
## Goal A minimal Rust backend binary that starts, reads configuration, exposes a health endpoint, and is wired into the Docker Compose deployment. ## Acceptance criteria ### Cargo layout - [ ] `backend/` workspace root with a `koinos` binary crate and a `koinos-core` library crate. - [ ] Rust edition 2021, MSRV pinned in `rust-toolchain.toml`. - [ ] Dependencies added: `axum`, `tokio`, `tower`, `tracing`, `tracing-subscriber`, `serde`, `serde_yaml`, `sqlx` (postgres), `anyhow`, `thiserror`, `config`. ### Runtime - [ ] `GET /healthz` returns `200` with JSON `{"status":"ok","version":"<pkg_version>","commit":"<git_sha>"}`. - [ ] `GET /readyz` returns `200` only if DB reachable, `503` otherwise. - [ ] Structured JSON logs via `tracing-subscriber`. - [ ] Graceful shutdown on SIGTERM. ### Configuration - [ ] Layered config: defaults → `koinos.yaml` → env (`KOINOS__*`). - [ ] Config struct validated at startup; malformed config exits non-zero with a clear error. ### Container - [ ] `Dockerfile` multi-stage (cargo-chef for caching) producing a ~30 MB runtime image. - [ ] Image wired into the Compose file from #2. ### Tests - [ ] Integration test spawning the server on a random port and hitting `/healthz`. ## Out of scope - OIDC, FHIR client, Matrix client — tracked in later issues. - Production observability (Prometheus) — later chore. ## References - `spec/03-architecture/01-overview.md` §3 (Koinos backend). - `spec/08-roadmap-mvp.md` — step #3.
claude-desktop added this to the v0.1 milestone 2026-04-14 20:40:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/koinos#3
No description provided.