forge
Explore
Log in

Don't you dare go Hollow

b2179ecf75d9f5953b2923f6493f8565a0c34fb5Ahmet Kaan GümüşParent: 34b37da
  • docs
    • 📝 add README
Show full message
docs: 📝 add README

Run, build, and deploy notes — the /api reverse-proxy contract and
the VITE_API_URL escape hatch — plus a map of the source layout.
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.