This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
The post-OTP routes are protected and require a valid session token produced by the auth provider's verify-otp-token endpoint. Set these env vars for local development:
VITE_AUTH_PROVIDER_BASE_URL- auth-provider base URL (for examplehttp://127.0.0.1:8080)VITE_RH_OAUTH_CLIENT_ID- OAuth client id used for OTP token exchangeVITE_RH_OAUTH_CLIENT_SECRET- optional secret for confidential clients
- Runtime contract endpoint is
GET /rh/schemafromauth-provider. - Canonical committed contract artifact is
auth-provider/rh/openapi/openapi.json. - Generated account API types live at
src/api/generated/account-openapi.d.ts(committed; not gitignored). - When backend
rh/API contract changes, export and commitopenapi.jsonin auth-provider, copy it into rent-history, then regenerate and commit frontend types:
# After auth-provider exports rh/openapi/openapi.json:
cp ../auth-provider/rh/openapi/openapi.json src/api/contract/account-openapi.json
yarn generate:api:accountyarn generate:apiis an alias forgenerate:api:account(data-api codegen is deferred).- Pinned spec for codegen and CI:
src/api/contract/account-openapi.json(copy of auth-provider’s committed artifact). - CI: GitHub Actions run on pushes to
mainand on all pull requests:.github/workflows/ci.yml—format:check,lint,test,build.github/workflows/account-openapi-contract.yml— regenerates from the pinned spec and fails ifyarn generate:api:accountwould change the committed.d.ts
- Local CI reproduction:
yarn format:check && yarn lint && yarn test && yarn build - Netlify / builds: Use the committed
account-openapi.d.tsonly; no auth-provider checkout required at build time. - When backend
rh/API contract changes, update frontend typed client/request handling in the same PR or in a linked PR (hook migrations follow the Tier 1 codegen plan).
| Path | Role |
|---|---|
contract/account-openapi.json |
Pinned OpenAPI spec (sync from auth-provider on contract changes) |
generated/account-openapi.d.ts |
Committed OpenAPI types (yarn generate:api:account) |
account/ |
Typed openapi-fetch client, imperative /rh/* API (api.ts), errors, types, TanStack Query hooks (index.ts barrel) |
data/README.md |
Placeholder for a future read-only data API (not used in v1) |
thirdParty/ |
Hand-written modules for external hosts (GeoSearch) |
Architecture reference: frontend-api-architecture.md in cursor-workspaces/rent-history-analyzer/codegen/docs/.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: import.meta.dirname,
},
},
});- Replace
tseslint.configs.recommendedtotseslint.configs.recommendedTypeCheckedortseslint.configs.strictTypeChecked - Optionally add
...tseslint.configs.stylisticTypeChecked - Install eslint-plugin-react and update the config:
// eslint.config.js
import react from "eslint-plugin-react";
export default tseslint.config({
// Set the react version
settings: { react: { version: "18.3" } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,
},
});