blog
Why Chronicler's API has one product endpoint
I first split Chronicler's API between GraphQL and REST. Five days later I replaced the split with one GraphQL endpoint and a short list of HTTP exceptions. This is the rule, what I put around it, and what isn't finished.
I first split Chronicler's API between GraphQL and REST. Five days later I replaced the split with one GraphQL endpoint and a short list of HTTP exceptions. This is the rule, what I put around it, and what isn't finished.
Chronicler is a campaign-management app with a Go API, a web app and a Discord bot. This post is about how I decided which of the API’s calls go through GraphQL and which stay plain HTTP.
The first rule split the work
On 2026-10-09 the rule was that nested reads go through GraphQL, while fixed reads and commands go through REST.
The cost showed up fast. Every product feature had two possible homes, and the web app and the bot had to know which one to use. Two contracts described the same product.
Five days later it was one endpoint
On 2026-10-14 I replaced the split. Every product query and every business command now goes through POST /v1/graphql. Four things stay on HTTP: authentication, health checks, the Discord activity ingest and heartbeat, and the agent question protocol. Those are machine protocols with their own authentication and error handling, and moving them would only have broken them.
I turned down two other options. One was REST wrappers over the GraphQL commands, which would have kept a second product API alive. The other was deleting the HTTP protocol endpoints.
The schema has 82 queries and 82 mutations. The cutover is a breaking change, so the web app’s old REST adapters need their own migration.
What I put around the endpoint
One request carries one operation. There is no array batching, no uploads and no subscriptions. Depth is capped, and so is the number of root aliases. Introspection is off in production.
Expected failures, such as not found or not allowed, come back with a code in errors.extensions.code. Anything unexpected comes back as an opaque INTERNAL.
Reads never write. Some reads used to acknowledge suppressed notifications and reconcile unlocks as a side effect. Now only commands do that, and each command owns one transaction.
The schema lives in one place, packages/contracts/graphql, and a script merges it into the file the clients use. A check fails if that merged file drifts from the source. For new fields there are two conventions: a closed set of values is an enum, and a paged list returns items and total. A second check lets those counts only go down.
Where GraphQL helped
The home page asks for site stats. The Discord activity totals behind them are read only when the request selects them, and a test asserts that.
Loaders collect the keys requested in the same two milliseconds, remove duplicates and fetch them in chunks of 100.
An earlier version of the API opened one database session per request, with a lock so sibling resolvers took turns. On 2026-07-30 I dropped the lock, because it deadlocked against real DataLoaders. Each resolver field and each loader batch now opens its own session.
What isn’t finished
The docs describe the design as accepted and the runtime cutover as pending. Quest commands and the legacy character and member reads are GraphQL only. The other product REST routes are still mounted. The performance budgets in the docs are targets, and there is no database receipt behind them yet.