feat(examples): add Postgres docker-compose overlays for both examples
feat(examples): add Postgres docker-compose overlays for both examples
#13 in tonybierman/arium — merged 2026-05-25
What
Mirrors the existing SQLite examples with an opt-in Postgres path for both the Dioxus and Leptos fullstack examples. SQLite stays the zero-dependency default.
Why it's not just a compose file
Backend is a compile-time choice — arium selects sqlite vs postgres via a cargo feature (with a compile_error! if both are on), so this can't be a runtime DATABASE_URL flip. The binary itself has to be built for Postgres.
Changes (per example)
- Cargo features — split the backend out of
server/ssrinto mutually-exclusivesqlite/postgresfeatures (sqlite is the default). Moved thesqlxdriver feature out of the base dep so it tracks the choice. Leptosbin-featuresbumped to["ssr", "sqlite"]sincessrno longer pulls a backend. main.rs—#[cfg]-gated pool construction (SQLite branch unchanged; Postgres branch requiresDATABASE_URLviaPgPoolOptions). Migrations are already dialect-aware, somigrator().run()just works.arium::pool::Pool— re-exported through both adapters and used for the dioxusAuth::<…>type param, replacing the concretesqlx::SqlitePool.docker-compose.postgres.yml(new, per example) — overlay adding apostgres:16-alpineservice (pgdatavolume,pg_isreadyhealthcheck,depends_on: condition: service_healthy) and overridingDATABASE_URL. Dockerfiles unchanged — they copy from the sametarget/paths; only the build command differs.- READMEs +
.env.exampleupdated with the Postgres run steps andPOSTGRES_*knobs.
Run it
# dioxus
dx bundle --release --platform web --package dioxus-fullstack-example --no-default-features --features web,server,postgres
docker compose -f docker-compose.yml -f docker-compose.postgres.yml up -d --build
# leptos
cargo leptos build --release --bin-features ssr,postgres
docker compose -f docker-compose.yml -f docker-compose.postgres.yml up -d --build
Verification
cargo checkandcargo clippy -D warningspass for both examples × both backends × default features.- Merged compose configs validate via
docker compose config. - Not yet run end-to-end against a live Postgres container (needs the full bundle build).
Notes
- CI still only exercises the SQLite path; a
--features postgrescheck job for the examples could be added as a follow-up.
🤖 Generated with Claude Code
Last updated 2026-05-26
Links to this note
Credits
Merged pull requests, newest first.