[package] name = "quotesdb" version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" default-run = "api" [features] # Enable API server code: Cloudflare D1 bindings, route handlers, and the # Workers fetch event entry point. Required for `cargo run` (native) and # `worker-build` (wasm32 Workers). Do NOT enable for Trunk UI builds. workers-api = [] [lib] crate-type = ["cdylib", "rlib"] [[bin]] name = "api" path = "src/bin/api/main.rs" [[bin]] name = "ui" path = "src/bin/ui/main.rs" # Shared dependencies: compile for both native host and wasm32-unknown-unknown. [dependencies] common = { path = "../common" } # UUID v4 for database primary keys; serde feature for serialisation. uuid = { version = "1", features = ["v4", "serde"] } # OsRng-based passphrase generation (WASM-compatible via getrandom/wasm_js). rand = "0.9" # Serialisation for shared types (API request/response models, Quote structs). serde = { version = "1", features = ["derive"] } serde_json = "1" # Error types with Display/std::error::Error derive — works on both native and wasm32. thiserror = "2" # Async trait support for the QuoteRepository abstraction — used on both native # and wasm32 (with ?Send on wasm32 to allow wrapping non-Send JS values). async-trait = "0.1" # Native-only dependencies (API server binary). # tokio, axum, and rusqlite are incompatible with wasm32-unknown-unknown. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Async runtime for the native API server. tokio = { version = "1", features = ["full"] } # HTTP framework for the native API server. axum = { version = "0.8", features = ["json"] } # SQLite driver for local development (native only; production uses Cloudflare D1). # Version pinned to 0.32 to match tokio-rusqlite 0.6's transitive dependency. rusqlite = { version = "0.32", features = ["bundled"] } # Async wrapper around rusqlite for use with Tokio. tokio-rusqlite = "0.6" # HTTP client for verifying Cloudflare Turnstile tokens server-side. reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } # WASM-only dependencies (Workers API binary + UI binary). # workers-rs, getrandom/wasm_js, and UI libraries are wasm32-specific. [target.'cfg(target_arch = "wasm32")'.dependencies] # Add the `js` feature to uuid on wasm32 to enable Web Crypto entropy for v4 UUIDs. uuid = { version = "1", features = ["js"] } # Cloudflare Workers SDK — provides D1 bindings, fetch, KV, etc. # The `http` feature makes the fetch handler accept/return standard http types, # enabling direct Axum router integration without manual request conversion. worker = { version = "0.7", features = ["d1", "http"] } # Axum HTTP framework for the WASM Workers entry point — minimal feature set # (no full tokio runtime needed; json and query features required for handlers). axum = { version = "0.8", default-features = false, features = ["json", "query"] } # Tower service trait — required by the WASM entry point to call the Axum router. tower-service = "0.3" # http crate — re-exported by axum and worker; needed explicitly so the return # type `http::Response` resolves in the fetch event handler. http = "1" # Entropy source for WASM targets: bridges uuid (v4) and rand (OsRng) to # crypto.getRandomValues() via the Web Crypto API. getrandom = { version = "0.4", features = ["wasm_js"] } # getrandom 0.3 is a transitive dep of rand 0.9 → rand_core 0.9; enable wasm_js feature. getrandom_03 = { package = "getrandom", version = "0.3", features = ["wasm_js"] } # Yew — Rust/Wasm frontend framework for building the SPA UI. yew = { version = "0.22", features = ["csr"] } # Yew Router — client-side routing for Yew SPAs. yew-router = "0.19" # Gloo — utility wrappers for Web APIs (timers, fetch, events, etc.). gloo = "0.11" # wasm-bindgen — Rust/Wasm JS interop; version must match wasm-bindgen-cli in Nix (0.2.108). wasm-bindgen = "0.2" # wasm-bindgen-futures — bridges Rust futures to JS Promises for async fetch. wasm-bindgen-futures = "0.4" # web-sys — raw browser DOM/Web API bindings. Storage and SessionStorage for auth code persistence. web-sys = { version = "0.3", features = ["Window", "Document", "HtmlElement", "Storage"] } # js-sys — JS standard library bindings, used for URL encoding in API client. js-sys = "0.3" # Build-time dependencies for compile-time YAML-to-JSON conversion of the # OpenAPI spec. serde_yaml is only needed at build time — it never enters # the Workers binary or native binary. [build-dependencies] serde_json = "1" serde_yaml = "0.9" [dev-dependencies] # `ServiceExt::oneshot` for sending single test requests to an Axum router. tower = { version = "0.5", features = ["util"] } # Temporary files for integration test SQLite databases. tempfile = "3" [profile.release] opt-level = "z" lto = true strip = true codegen-units = 1