Scaffold Next.js frontend with generated OpenAPI client and core views
Next.js (App Router) + React 19 + TypeScript + Tailwind v4, with shadcn-style UI primitives (Button, Input, Card, Label via cva/tailwind-merge). A typed API client is generated from the backend OpenAPI spec with openapi-typescript + openapi-fetch (npm run gen:api); the committed openapi.json/schema.d.ts are the snapshot. Views: landing, login, register, tree list + create, and tree detail with person list + create. Auth rides the same-origin HttpOnly session cookie the backend sets (Caddy proxies /api/*), so no token handling in JS. Built as a standalone container. Mobile-first; next build is clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Justin Paul <justin@jpaul.me>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import createClient from "openapi-fetch";
|
||||
|
||||
import type { paths } from "./schema";
|
||||
|
||||
// Same-origin in production (Caddy proxies /api/* to the backend). Override with
|
||||
// NEXT_PUBLIC_API_BASE_URL for split local dev. credentials:"include" sends the
|
||||
// HttpOnly session cookie the backend issues on login.
|
||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL ?? "";
|
||||
|
||||
export const api = createClient<paths>({ baseUrl, credentials: "include" });
|
||||
Reference in New Issue
Block a user