RustRover cargo-generate template: Axum + Vue 3 + TypeScript + Tailwind + sqlx
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # rust-template
  2. RustRover-ready fullstack starter: Axum + PostgreSQL + sqlx on the backend, Vue 3 + TypeScript + Tailwind 4 on the frontend.
  3. The backend route table is the API contract. `utoipa-axum` builds OpenAPI from the same handlers Axum serves. `just generate-api` writes `packages/contracts/openapi.json` and a typed Vue client. Vite reads `config/*.toml` and reverse-proxies `/api` and `/health` to the server bind address.
  4. ## Layout
  5. ```
  6. config/ shared TOML (server + Vite)
  7. apps/server/ Axum, sqlx, request logging, OpenAPI
  8. apps/web/ Vue 3 + TS + Tailwind
  9. packages/contracts/ generated openapi.json
  10. scripts/generate-api.mjs typed client from that spec
  11. infra/compose/ local Postgres
  12. ```
  13. ## Run it
  14. ```bash
  15. cp .env.example .env
  16. docker compose -f infra/compose/docker-compose.yml up -d postgres
  17. cargo run -p server
  18. ```
  19. ```bash
  20. cd apps/web && npm install && npm run dev
  21. ```
  22. - UI: http://127.0.0.1:5173
  23. - API: http://127.0.0.1:8080
  24. - Swagger: http://127.0.0.1:8080/api/docs
  25. Vite binds `127.0.0.1` on purpose. `localhost` can resolve to `::1` and miss the proxy.
  26. ## RustRover
  27. Open the repo root. Run `cargo run -p server` with `APP_ENV=development`.
  28. To use this as a New Project template: Settings → Languages & Frameworks → Rust → custom cargo-generate template → paste the Git URL of this repo.
  29. ## Config
  30. Load order:
  31. 1. `config/default.toml`
  32. 2. `config/{APP_ENV}.toml`
  33. 3. `APP__SECTION__KEY` environment variables
  34. ```bash
  35. APP__SERVER__PORT=9000 cargo run -p server
  36. ```
  37. Both processes honor `APP_CONFIG_DIR` if you need the files somewhere else.
  38. ## Add an endpoint
  39. 1. Handler + `#[utoipa::path(...)]`
  40. 2. `.routes(routes!(your_handler))` in `apps/server/src/routes/mod.rs`
  41. 3. `just generate-api`
  42. 4. Import the new function from `apps/web/src/api/generated.ts`
  43. Request logs include method, path, status, latency, and `X-Request-Id`.
  44. ## Useful commands
  45. ```bash
  46. just server
  47. just web
  48. just generate-api
  49. just check
  50. ```