Trunk.toml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Trunk configuration for the CSR/WASM UI.
  2. #
  3. # Run modes (never change the redirect URI off http://127.0.0.1:3000/callback):
  4. # dev (E2E target): `cd crates/web && trunk serve --port 3000`
  5. # plus the BFF on :3001; this file proxies /oauth/, /callback, /api/.
  6. # Trunk's proxy follows the BFF's /oauth/start 302 to the AS and swallows
  7. # it (200 empty body), so sign-in MUST bypass the proxy: run the BFF with
  8. # `APP_START_URL=http://127.0.0.1:3001/oauth/start` and the landing CTA
  9. # navigates straight at the BFF origin (top-level assign, cookies are
  10. # host-scoped so SameSite=Lax still holds across :3000 -> :3001).
  11. # demo/prod: `SERVER_BIND_ADDR=127.0.0.1:3000 cargo run -p server`
  12. # serves crates/web/dist directly; no Trunk process, no proxies, no
  13. # APP_START_URL override (relative /oauth/start is same-origin).
  14. #
  15. # Build (verification): `trunk build`. The executor never runs `trunk serve`.
  16. [build]
  17. target = "index.html"
  18. # Strict-CSP boot (no inline scripts). Trunk's default autoloader is an inline
  19. # `<script type="module">`, which the BFF's `STATIC_CSP` (`script-src 'self'
  20. # 'wasm-unsafe-eval'`, no `'unsafe-inline'`) refuses to execute. So:
  21. # - inject_scripts = false: Trunk injects no inline loader and no preloads;
  22. # - filehash = false: stable `web-app.js` / `web-app_bg.wasm` names that the
  23. # external `bootstrap.js` module can import statically (a content hash is
  24. # unknowable to a static loader).
  25. # `bootstrap.js` is copied to the dist root (see index.html) and referenced
  26. # there as a plain same-origin `<script type="module" src="/bootstrap.js">`.
  27. inject_scripts = false
  28. filehash = false
  29. [serve]
  30. addresses = ["127.0.0.1"]
  31. port = 3000
  32. # Forward every BFF-owned route to the axum server on :3001 so the browser
  33. # sees a single origin (no CORS, cookies stay same-site). With no `rewrite`
  34. # the backend path is the match prefix: /oauth/start -> :3001/oauth/start.
  35. [[proxy]]
  36. backend = "http://127.0.0.1:3001/oauth/"
  37. [[proxy]]
  38. backend = "http://127.0.0.1:3001/callback"
  39. [[proxy]]
  40. backend = "http://127.0.0.1:3001/api/"
  41. # Pin CLI tools so the wasm-bindgen CLI matches the crate dependency exactly
  42. # (`wasm-bindgen = "=0.2.129"` in Cargo.toml) and Tailwind runs v4.
  43. # The Tailwind CLI is a standalone binary; no Node/npm is required.
  44. [tools]
  45. wasm_bindgen = "0.2.129"
  46. tailwindcss = "4.3.3"