Turnpike/frontend/README.md

35 lines
902 B
Markdown
Raw Normal View History

2026-03-03 11:39:15 -06:00
# Turnpike Frontend
2026-03-03 11:39:15 -06:00
Svelte 5 + Vite PWA. Offline-first with Dexie (IndexedDB) and background sync.
2026-03-03 11:39:15 -06:00
## Development
2026-03-03 11:39:15 -06:00
From the repo root with `direnv allow` (or Node.js 18+ installed):
2026-03-03 11:39:15 -06:00
```sh
cd frontend
npm install
npm run dev
```
2026-03-03 11:39:15 -06:00
Runs on `:5173`, proxies `/api` to the Go backend on `:8180`.
2026-03-03 11:39:15 -06:00
## Build
2026-03-03 11:39:15 -06:00
```sh
npm run build
```
2026-03-03 11:39:15 -06:00
Output goes to `dist/`, which the Go binary embeds at compile time.
2026-03-03 11:39:15 -06:00
## Architecture
2026-03-03 11:39:15 -06:00
- `src/db.js` — Dexie schema, session management
- `src/api.js` — all API calls, injects `Authorization: Bearer` header
- `src/sync.js` — sync pull, SSE stream, outbox flush
- `src/pages/` — page components (one per route)
- `src/components/` — shared UI components
- `src/app.css` — global CSS custom properties (colors, spacing, type scale)
2026-03-03 11:39:15 -06:00
All UI reads come from Dexie via `liveQuery()`, not direct API calls. Styles are scoped per component; no hardcoded color values.