- Nuxt 3 CSR (ssr:false), @nuxtjs/tailwindcss, dev proxy to backend - useAuth composable: CSRF cookie, XSRF token, login/logout/fetchUser - auth middleware: redirects to /login if no session - Login page, client list with search + create modal - Client detail with editable name, dynamic notes (JSON), history feed - History form with type select, inline edit/delete per entry - Print layout at /clients/:id/print (calls window.print on mount) - TypeScript interfaces: User, Client, HistoryEntry, PaginatedResponse - German UI labels throughout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
Frontend — Nuxt 3 CSR
Structure
pages/— file-based routing (CSR only, all behind auth middleware)composables/useAuth.ts— login/logout/user state (singleton via useState)composables/useClient.ts— CRUD + listcomposables/useHistory.ts— history entry CRUD per clientcomponents/client/— ClientCard, ClientFieldscomponents/history/— HistoryEntry, HistoryFormmiddleware/auth.ts— redirects to /login if no sessiontypes/index.ts— shared TypeScript interfaces
Auth flow
GET /sanctum/csrf-cookiesets XSRF-TOKEN cookiePOST /api/loginwith credentials — Laravel sets session cookie- All subsequent requests: include both cookies via
credentials: 'include' - XSRF-TOKEN decoded and sent as
X-XSRF-TOKENheader on mutating requests
API calls
Always use the useApiFetch composable pattern:
const data = await $fetch('/api/clients', { credentials: 'include' })
Tailwind
Desktop-first, no mobile breakpoints in MVP. Dense, data-focused UI — think DATEV/Outlook aesthetics.
Commands
npm run dev # dev server on :3000
npm run build # production build
npm run typecheck