Aforo
One booking contract, four conformant backends and two clients built on it
- Status
- Live demo
- Type
- Developer tool
- Started
- November 2026
- Role
- Architect and sole engineer
- Domains
- API design, contract testing, concurrency, reference architecture
- Stack
- OpenAPI, JSON Schema, Hurl, Schemathesis, Java, Spring Boot, Csharp, Aspnetcore, Go, Gin, Ruby, Rails, React, Angular
Aforo Live demo One booking contract, four conformant backends and two clients built on it
Developer tool
Context and problem
One API contract, four implementations (Spring Boot, ASP.NET Core, Go, Rails), 379/379 cases each.
Comparing stacks without a shared, executable spec is anecdote: RealWorld-style apps have no invariant that can break under concurrency. The Aforo suite fires 300 simultaneous clients at a 50-seat event.
Approach
One written contract and one conformance suite, then four independent implementations: Spring Boot (L01), ASP.NET Core (L02), Go (L04) and Rails (L08). Each passes the full profile, 379/379 cases on contract 2.0.0, including a race of 300 simultaneous clients on a 50-seat event that must confirm exactly 50 and waitlist 25. A React client (L09) and an Angular client (L10) pass one shared end-to-end suite.
Screens
How it was built
5 repos · conformance 379/379 each
From the build report, 21 November 2026.
Decisions and trade-offs
- Spring Boot (L01) locks the event row (SELECT ... FOR UPDATE) for every booking and cancellation, instead of optimistic @Version retries or an atomic conditional UPDATE: the seat invariant holds by construction with no retry loops; the cost is that one busy event serializes its bookings. The same row lock covers the 2.0.0 invitations. (L01 ADR-0001)
- L01 orders its errors with servlet filters instead of Spring Security: the contract fixes the error order (405, 401, 404, 403, 400, 422, 428/412, 409), and Spring Security answers 401 before routing. (L01 ADR-0005)
- L01 hand-writes its controllers against the OpenAPI copied verbatim from the pinned spec tag, with a check that fails on drift, instead of openapi-generator: generated validated DTOs would answer 422 where the contract requires 403 or 404. (L01 ADR-0002)
- Contract 2.0.0 answers 202 to every member invitation, whatever the email, instead of keeping the old 422 answer behind a rate limit: in 1.x any tenant owner could probe which emails have an account, and a rate limit would only slow the probe down. (r1 migration-2.0.md)
- The suite was proved against an independent in-memory reference implementation, written apart from the Hurl files, instead of shipping it unrun or mock-testing each file: a conformance suite that has never passed against anything proves nothing, and each disagreement exposed an ambiguity in the spec. (r1 ADR-0002)
Results with dated evidence
379/379 conformance cases on contract 2.0.0 in each implementation: Hurl 63, security 148, webhooks 6, race 5, Schemathesis 51 (one case per API operation), Newman 106. Runs on local-lite (no PostgreSQL yet; the ZAP scan waits for the Docker phase).
Checked against Trysac/r1-aforo-spec results/registry.yaml and results/L01, L02, L04, L08/2026-11-21.json; breakdown in Trysac/l01-ref-api-spring-boot CHANGELOG.md on 21 November 2026.
- Commit
-
b59b3516f541a74eb77862c7bf340426004bae3a - Dataset
- 379 cases , v2.0.0
Outcomes as stated in the manifest; the measured figures are the ones with a date.
- Full Aforo conformance profile 379/379 on contract 2.0.0 in Spring Boot (L01), ASP.NET Core (L02), Go (L04) and Rails (L08).
- L04: own race with 500 goroutines through the HTTP API, exactly 50 confirmed, 25 waitlisted, 425 event-full.
- L08: one process, two SQLite files; Litestream restores the data in 70 ms, verified by a hash of every row.
- L09 React client: all 28 shared end-to-end scenarios pass on desktop and mobile against the reference implementation.
Highlights
contract first, conformance suite, optimistic concurrency, polyglot