📝 add README
Browse files at this commitb2179ecf75d9f5953b2923f6493f8565a0c34fb5Parent: 34b37da- docs
- 📝 add README
1 changed file +37 -0
- README.md +37 -0
README.mdadded+37 -0
| @@ -0,0 +1,37 @@ | |||
| 1 | +# hezarfen_frontend | ||
| 2 | + | ||
| 3 | +SolidJS SPA for [hezarfen_backend](../../Rust/hezarfen_backend). Bun for tooling, | ||
| 4 | +Vite for dev/build, `@solidjs/router` for lazy-loaded routes — no other runtime | ||
| 5 | +dependencies. | ||
| 6 | + | ||
| 7 | +## Run | ||
| 8 | + | ||
| 9 | +```sh | ||
| 10 | +bun install | ||
| 11 | +bun run dev # http://localhost:5173, proxies /api -> http://127.0.0.1:8080 | ||
| 12 | +``` | ||
| 13 | + | ||
| 14 | +Start the backend first (`cargo run` in the backend repo). The dev server | ||
| 15 | +proxies `/api/*` to it, so the session cookie stays same-origin and CORS never | ||
| 16 | +enters the picture. | ||
| 17 | + | ||
| 18 | +## Build | ||
| 19 | + | ||
| 20 | +```sh | ||
| 21 | +bun run check # typecheck | ||
| 22 | +bun run build # dist/ | ||
| 23 | +``` | ||
| 24 | + | ||
| 25 | +Serve `dist/` behind any reverse proxy that maps `/api/*` to the backend | ||
| 26 | +(strip the `/api` prefix). To point the SPA at an absolute API origin instead, | ||
| 27 | +set `VITE_API_URL` at build time. | ||
| 28 | + | ||
| 29 | +## Shape | ||
| 30 | + | ||
| 31 | +- `src/lib/api.ts` — typed client; every endpoint, one `ApiError` shape. | ||
| 32 | +- `src/lib/auth.tsx` — session context; `/auth/me` fetched once, mutated in place. | ||
| 33 | +- `src/lib/action.ts` — pending/error wrapper for mutations. | ||
| 34 | +- `src/pages/*` — one file per route, lazy-loaded. | ||
| 35 | + | ||
| 36 | +Mutations update resources from the server's response (`mutate`), never by | ||
| 37 | +refetching — the UI reacts in the same frame the request resolves. | ||