There are no passwords, no cookies and no session state in this codebase, because the application is never reachable by anyone Access has not already identified.
Engineering notes
Auth boundary, integer money & deploy gates
01Facts
- Scale
- 20,500 lines, 17 tables, 31 tests
- Runtime
- Cloudflare Workers, Next.js via vinext
- Data
- Cloudflare D1
- Authentication
- Cloudflare Access, and nothing else
- Access
- Private, owner only
02The authentication boundary is not in the application
Cloudflare Access sits in front of the Worker and is the only authentication boundary. The application does not implement a login, and it cannot be tricked into a weak one, because it has none to weaken. Logout is delegated to the Access endpoint. The Worker fails closed if the Access identity or the configured owner email is missing, so a misconfiguration produces a locked door rather than an open one.
03Money is an integer
Amounts are stored as integer minor units and converted to LKR only at the API boundary. Dates and timestamps are ISO strings, booleans are checked integers, and non-currency decimals are the only place a real number is allowed.
04Deploys are gated
The build is verified before it ships and deployment runs behind a preflight script, so a broken build fails at my terminal rather than at the edge. Migrations have check, status and apply commands, which matters when the datastore is D1 and there is no second chance at a bad migration.