From e5400c89921275553c9de4673fb94174e5e2a3bd Mon Sep 17 00:00:00 2001 From: Marcel Enguehard Date: Wed, 29 Jul 2026 20:30:55 +0200 Subject: [PATCH] Set up cargo workspace backbone Two-crate workspace: immo-core for pure financial logic (wasm-compatible, no async/IO deps) and immo-web for HTTP and rendering. Both crates are still cargo-new skeletons; no domain code yet. Pins the toolchain to 1.97 with rustfmt, clippy and the wasm32-unknown-unknown target so the core crate's wasm constraint is checkable locally. Cargo.lock is committed since the workspace ships a binary. Co-Authored-By: Claude Opus 5 --- .gitignore | 22 +++++++++ CLAUDE.md | 94 +++++++++++++++++++++++++++++++++++++ Cargo.lock | 11 +++++ Cargo.toml | 7 +++ crates/immo-core/Cargo.toml | 7 +++ crates/immo-core/src/lib.rs | 14 ++++++ crates/immo-web/Cargo.toml | 7 +++ crates/immo-web/src/main.rs | 3 ++ rust-toolchain.toml | 4 ++ 9 files changed, 169 insertions(+) create mode 100644 .gitignore create mode 100644 CLAUDE.md create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 crates/immo-core/Cargo.toml create mode 100644 crates/immo-core/src/lib.rs create mode 100644 crates/immo-web/Cargo.toml create mode 100644 crates/immo-web/src/main.rs create mode 100644 rust-toolchain.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a934e75 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# Build artifacts +/target +**/*.rs.bk +*.pdb + +# Cargo.lock is committed: this workspace produces a binary (immo-web). + +# Coverage / profiling +*.profraw +*.profdata +/tarpaulin-report.* +/cobertura.xml + +# Editor and OS +.DS_Store +.idea/ +.vscode/ +*.swp + +# Local environment +.env +.env.local diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..53c564a --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,94 @@ +# CLAUDE.md + +## Project + +Web app that answers one question with data: for a given property in France, is buying +financially better than renting and investing the same cash? It outputs an amortisation +schedule, total ownership costs, and breakeven curves under several market hypotheses. + +This is a financial tool. A wrong number is worse than a slow response, an ugly page, or a +missing feature. Correctness and traceable sources come first. + +I am learning Rust through this project. See "Working with me" below. + +## Commands + +```bash +cargo run -p immo-web # start the server on :3000 +cargo watch -x 'run -p immo-web' # live reload during development +cargo test --workspace # all tests +cargo test -p immo-core # domain tests only, fast +cargo fmt --all +cargo clippy --workspace --all-targets -- -D warnings +``` + +Run `cargo clippy` and `cargo test -p immo-core` before telling me a change is finished. + +## Architecture boundary + +Two crates. The boundary is a rule, not a description. + +`crates/immo-core` holds all financial logic as pure functions over plain structs. + +- No `tokio`, no `axum`, no `reqwest`, no filesystem, no network access. +- Must stay compilable to `wasm32-unknown-unknown`. After adding any dependency, verify with + `cargo check -p immo-core --target wasm32-unknown-unknown`. +- Time is a parameter. Never call `Utc::now()` or read the system clock inside `immo-core`. + +`crates/immo-web` holds HTTP, HTML rendering, and input parsing. It contains no financial +arithmetic. + +If a computation is tempting to write inline in a handler, it belongs in `immo-core`. + +## Stack, pinned + +- axum 0.8. Path parameters use `{param}`, **not** `:param` — that is 0.7 syntax and will not compile. +- `#[async_trait]` is not needed on `FromRequest` / `FromRequestParts` in 0.8. Do not add it. +- askama for templates, tower-http for static files and compression, serde, rust_decimal. +- Server-rendered HTML. No npm, no bundler, no JS framework. Charts are a CDN `