Repositories and contracts
The contract is the boundary
pennyplan-api owns every request and response schema. On each build it publishes openapi/openapi.json.
pennyplan-web generates its typed client from that file. Nobody hand-copies a type across repositories.
# in pennyplan-api
pnpm openapi:generate # writes openapi/openapi.jsonCI uploads the spec as a build artifact on every run.
Small logic is duplicated on purpose
The amount and phrase parser (“airtime 500”, “gave mum 5k”) runs authoritatively on the API. The web app may keep a light copy so users see an instant preview, even offline.
Duplication is only safe if the two cannot silently drift, so:
- Both repositories test against the same fixture file, kept byte-identical and verified by checksum in CI.
- Fixture files are versioned (
phrases.v1.json) and never edited in place. A new set isphrases.v2.json. - The API’s answer is authoritative. The web copy may decline to parse, but must never give a different answer.
Releasing independently
Routes live under /v1. Because breaking changes go to /v2 or behind a flag, the web app and API can be
released on their own schedules.
Working across repositories
If a change needs both, the API change ships first, and the web change is written up as a follow-up task in the web repository.