App Frontend Adapter
When to use
After the strategy is fixed by app-compatibility-engine.
Inputs
- Strategy, build output dir, package manager, API base URL env var.
Procedure
- Never edit the site's configs. All overrides live in
os/<target>. static: build with the site script (npm run build/pnpm build/yarn build/bun run build) and point the shell at the output. Relative base: Vite--base ./, CRAPUBLIC_URL=., Angular--base-href ./.next-export:os/<target>/next.config.export.mjsthat imports the site config and addsoutput: "export",images: { unoptimized: true },trailingSlash: true; build withNEXT_CONFIG_FILEor a copy step inos/<target>, outputout/.client-shell: createos/<target>/web(Vite + React or Next export) reusing components; replace Server Actions and server data loading by an API client:const API = import.meta.env.VITE_API_URL; // https only export const api = (p: string, init?: RequestInit) => fetch(`${API}${p}`, { credentials: "include", ...init });- Mobile adaptation:
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">,padding: env(safe-area-inset-top) ..., touch targets min 44px, inputs not hidden by the keyboard (@capacitor/keyboardresize), hardware back mapped to router back (app-native-capabilities), no hover only interactions. - Hash or memory routing when the shell cannot serve deep links.
Verification
Serve the dist locally (npx serve -s <dist>) and run tests/desktop/smoke.spec.ts of app-factory; no 404 on assets.
Failure modes and fixes
- White screen: absolute
/assets/...paths or<base href="/">; switch to relative base. - Mixed content: every API URL must be
https://. windowundefined in reused server components: mark"use client"or move to the client shell.
Deliverable
A static frontend dist for frontendDist / webDir; report step frontend.
