generated from nholtware/service-template-react
1.5 KiB
1.5 KiB
Service conventions
- Stack: Vite + React 19 + TypeScript + React Router v8 in data mode (
createBrowserRouter, SPA, no SSR), Node 22 for build only, vitest + Testing Library, nginx-unprivileged at runtime. - Do NOT rename npm scripts (
lint,test,format:check,build): the shared CI composite actions call them. - Routes: table in
src/routes.tsx, one component per file insrc/routes/, loaders exported next to their component. - Runtime config: read only via
getConfig()(src/lib/config.ts). A new browser-visible env var must be added toVARSindocker-entrypoint.d/10-config.sh,AppConfig, and the gitops Deployment. No secrets: config.js is public. - Feature flags:
useFlag/useVariantfromsrc/lib/flags.tsxonly (Unleash Frontend API via@unleash/proxy-client-react); never import the SDK elsewhere. EmptyUNLEASH_URL= all flags off. - Backend calls:
apiGet()insrc/lib/api.ts, relative toAPI_BASE_URL(/apisame-host ingress path, stripped before the backend). No CORS. - Logging: nginx access log is JSON in the platform logging contract (
log_format contractinnginx/default.conf;$app_name/$git_shafromconf.d/service-vars.confwritten by10-config.sh). Keep field names identical to the backend template's pino-http lines. - Serving contract: port 8080,
/healthz200, SPA fallback, immutable/assets/, no-cacheindex.html/config.js(nginx/default.conf). - Deploy: push to
main-> Forgejo CI -> image -> gitops bump -> ArgoCD. Neverkubectl applyby hand.