# @suaveplan/demo Unified Bun + Hono server with a React 19 SPA front-end and a JSON API in one process. Demonstrates locale-prefix routing across five base locales, `@suaveplan/api-plugin-auth`-driven Better-Auth authentication backed by SurrealDB, and React + Tailwind v4 styling. ## What's wired up - **Server** — single Bun process running a Hono app on port `3300` (override with `PORT=…`). The Hono instance is the one owned by a `SuaveApp` from `@suaveplan/api`. `/api/health` is registered by `registerHealthRoutes`; `/api/auth/*` is mounted by `@suaveplan/api-plugin-auth` (9 OpenAPI routes + the Better-Auth catch-all); `/api/me` is a demo convenience that calls `authService.getSession(headers)`; everything else falls through to the Vite-built client bundle in `dist/client/`, with `index.html` fallback so the client router owns deep links. - **Auth** — the canonical genesis pipeline. The Hono app is assembled via `defineApp()` from `@suaveplan/api`, with `createAuthPlugin(...)` from `@suaveplan/api-plugin-auth` registered as a plugin. The auth plugin's 6-step `onInit` applies the bundled 17-table Better-Auth SurrealQL schema, constructs the real Better-Auth instance backed by `betterAuthSurrealAdapter` (from `@suaveplan/better-auth-surrealdb`, the Better-Auth v1.6 `DBAdapterInstance` factory), registers the typed `authService` on the host `ServiceRegistry`, mounts the 9 OpenAPI routes plus the Better-Auth catch-all under `/api/auth/*`, and installs the global session-resolver middleware so every request gets a typed `Principal` on its Hono context. A small inline `demo-db-seed` plugin (in `src/server/auth.ts`) drops the live `SurrealAdapter` into `ServiceRegistry["db"]` during `onRegister` so the auth plugin can resolve it during `onInit`. Backing store is an **external SurrealDB** reached via `SURREAL_URL` (default `ws://localhost:8000`), namespace `SURREAL_NS` (default `demo`), database `SURREAL_DB` (default `demo`), credentials `SURREAL_USER` / `SURREAL_PASS` (default `root` / `root`). - **Client** — React 19 + Vite + `@tailwindcss/vite` for Tailwind v4. Routing via `react-router-dom@7` with a locale-prefix design. The app root composes `` (from `@suaveplan/react-ui`) around the entire tree, seeded with a singleton `I18nInstance` (`createI18n` from `@suaveplan/i18n`) and the chassis `lightTheme` plugin. `` internally wraps `` → `` → `` and auto-registers the matching chassis locale bundle on mount / language change, so any react-ui primitive that calls `useTranslation(...)` finds a populated catalog. Form pages (`/auth/login`, `/auth/register`, `/auth/forgot-password`, `/user/settings`) compose ``, ``, ``, ``, `