No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

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