Vite Client
Build a Vite frontend that talks to the Kernia FastAPI demo backend.
The Vite example is the simplest browser client for Kernia. It calls the Python backend at /api/auth, includes credentials, and renders provider availability from real server/admin configuration.
Environment
VITE_AUTH_BASE_URL=http://localhost:8000/api/auth
VITE_APP_BASE_URL=http://localhost:5173API helper
const baseURL = import.meta.env.VITE_AUTH_BASE_URL;
export async function authAPI(path: string, init: RequestInit = {}) {
const response = await fetch(`${baseURL}${path}`, {
...init,
credentials: "include",
headers: { "content-type": "application/json", ...(init.headers ?? {}) },
});
if (!response.ok) throw await response.json();
return response.json();
}Login methods
Render buttons from the admin public config endpoint. If Google, passkey, SSO, phone, SIWE, or another method is not configured, show a disabled state instead of pretending the flow works.
Settings pages
Use Kernia APIs for:
- Profile.
- Linked accounts.
- Sessions.
- API keys.
- Security.
- Billing.
Settings pages should refresh /get-session after profile and security mutations.
Admin pages
Admin pages should call backend admin routes for auth methods, email clients, Stripe setup, products, prices, entitlements, usage, users, and webhooks. Secrets must be write-only and redacted on read.
Browser test
Use Playwright against the running Vite app and FastAPI backend. Cover email sign-in, logout, session refresh, API key create/revoke, admin method toggles, email provider config, Stripe import, and unavailable provider states.