Developers
Riffover API
The Riffover REST API at api.riffover.com: conventions, versioning, errors and resources.
On this page
https://api.riffover.com is the Riffover REST API. The website's Next.js app (web/) serves it: next.config.ts rewrites the api. host to the app's /api routes, and www.riffover.com/api/… redirects to the API host, so every resource has one address. Locally, it answers at both http://localhost:3000/api and http://api.localhost:3000. Everywhere except production, the site links to /api. URLs inside responses are built from the request's own host (ctx.url(path) in a handler), so a local response links to local URLs.
It has no resources yet. They'll arrive with accounts, leaderboards and shared charts.
Conventions#
These follow the syntaqx.com playbook, and GitHub's API for the root.
-
JSON only. Every response is
application/json; charset=utf-8, errors and server failures included, apart from bodiless204s. A request whoseAcceptheader rules out JSON gets a406, and its body is JSON too. -
Bodies are the resource. An object for one resource, an array for a list, and no envelope. Metadata goes in headers:
Linkfor pagination,Request-IdandApi-Version. -
Naming:
- Paths are plural kebab-case nouns with no trailing slash (
/line-items). A path with a trailing slash is a404. - Query parameters and JSON fields are snake_case.
- Timestamps end in
_atand use RFC 3339. - Booleans start with
is_,has_orcan_. - IDs are UUID v7 strings.
- Paths are plural kebab-case nouns with no trailing slash (
-
The root lists the API's resources, one absolute
*_urlper entry point, likehttps://api.github.com. It lists API resources only, never the website's pages. With no resources yet, it's{}. -
No version in the path. Clients pin a dated version with the
Api-Versionrequest header, and the response echoes it. A request without the header is served by the oldest supported version. An unknown version gets a400that lists the supported ones. A breaking change ships as a new dated version, never in place.- Supported versions:
2026-12-04.
- Supported versions:
-
Errors are always the same shape, and the status code carries the outcome:
json{ "message": "The given data was invalid.", "errors": { "email": ["The email field is required."] } }errorsappears only for field-level failures (422), keyed by dot paths. -
Every response carries a
Request-Id(UUID v7). Log it, and include it in bug reports. -
Methods:
- A method a resource doesn't support gets a
405, withAllowlisting the ones it does. OPTIONSanswers CORS preflights.- CORS is open to any origin while the API is public and read-only.
- A method a resource doesn't support gets a
Resources#
| Method | Path | Returns |
|---|---|---|
GET |
/ |
The API's entry points (none yet: {}) |
Adding a resource#
The handlers live in web/app/api/, and the helpers live in web/lib/api.ts. Wrap every exported method in route(), which adds the shared headers, the version and Accept checks, and the JSON 500. Return json(...) or error(...). Then list the resource in the root (web/app/api/route.ts) and in the table above.