Files
harmony/examples/dx_guide_ship/README.md
Jean-Gabriel Gill-Couture eea006535b refactor: drop harmony_app landfill
Scores own deploy. harmony_app is identity, images, context, and
HarmonyApp→Scores. Authoring DX lives in dx. Compose/chart/Application
model and the Helm render test are gone.
2026-09-08 22:10:34 -04:00

40 lines
1.4 KiB
Markdown

# Getting started: one file per component
Junior-shaped ship inventory (ADR-029). Opening `frontend.rs` *is* the
frontend. There is no `FrontendCommand` type.
```bash
cargo check -p example-dx-guide-ship
```
## Copy this layout
| File | What it is |
|------|------------|
| `src/main.rs` | Inventory: `.component::<Frontend>()` + contexts |
| `src/frontend.rs` | `impl Command` (`npm run dev`) and `impl Container` |
| `src/backend.rs` | Same, plus `env()` wiring via `Ref<Postgres>` etc. |
| `src/postgres.rs` | Container (or Remote in production). `PostgresScore` |
| `src/zitadel.rs` | `ZitadelScore` — do not invent `AppScore` |
| `src/bucket.rs` | `BucketScore` |
| `src/localdev.rs` | `Context::new("localdev").bind::<Frontend>(Runtime::Command)` |
| `src/production.rs` | Frontend/Backend as Container; managed bits as Remote |
| `src/harmony.rs` | Stub framework types. Not `harmony_app`. |
## Runtime is an enum
```rust
Context::new("localdev").bind::<Frontend>(Runtime::Command)
```
`Runtime` is `Command | Container | Remote`. Binding `Runtime::Command` on
Postgres **compiles**. The type system does not know Postgres has no
`impl Command`. That is the tradeoff: obvious API, few traits, illegal
binds are not a type error. (The other DX crates make that a type error.)
## Cycles
`Frontend::env` takes `Ref<Backend>` and `Backend::env` takes
`Ref<Frontend>`. Those URLs are allocated before either side starts.
A Ref is desired state, not a live connection.