Turnpike/frontend/README.md

34 lines
902 B
Markdown

# Turnpike Frontend
Svelte 5 + Vite PWA. Offline-first with Dexie (IndexedDB) and background sync.
## Development
From the repo root with `direnv allow` (or Node.js 18+ installed):
```sh
cd frontend
npm install
npm run dev
```
Runs on `:5173`, proxies `/api` to the Go backend on `:8180`.
## Build
```sh
npm run build
```
Output goes to `dist/`, which the Go binary embeds at compile time.
## Architecture
- `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)
All UI reads come from Dexie via `liveQuery()`, not direct API calls. Styles are scoped per component; no hardcoded color values.