Vanilla Breeze

Service Contracts

JSON request/response schemas for every /go/ endpoint — what backend implementations must fulfill and what VBService consumers can rely on.

JSON request/response schemas for every /go/ endpoint. VB ships the contracts and a VBService client; you ship a backend that fulfils them. Pick the worker, framework, or service of your choice.

Common conventions

  • Content type — all requests and responses are application/json. VBService sets the request content-type automatically and parses JSON responses.
  • Authentication — out of scope for the contract. Inject auth via VBService.configure({ headers: { Authorization: '…' } }) and validate server-side however you like.
  • HTTP status codes — standard. 200 on read success, 201 on create, 202 on async accept, 204 when there is no body, 4xx/5xx on errors.
  • Pagination — query params limit, since where listed. Beyond v1, add cursor-based pagination as needed.

Error response

Every /go/ endpoint uses a single error envelope on non-2xx responses. VBService wraps this in a VBServiceError with { status, body, role, path } for consistent client-side handling.

  • error — short snake_case code (not_found, invalid_input, rate_limited, unauthorized, internal)
  • message — human-readable detail; safe to show in dev consoles, not necessarily user-facing
  • status — mirrors the HTTP status code for clients that don’t plumb the response status through their wrapper

/go/notify — Notifications

Powers <notification-wc> in panel mode, plus the page-watch subscription flow.

GET /go/notify/messages

Fetch notifications for the current user/session.

ParamTypeDefaultPurpose
sinceISO datetimeOnly return notifications after this timestamp
typestringFilter by type (update, alert, watch, stewardship, …)
unreadbooleanOnly return unread notifications
limitnumber50Maximum items to return

PATCH /go/notify/messages/:id

Mark a notification as read or dismissed.

POST /go/notify/subscribe

Subscribe to page-watch or topic notifications. The notify array selects delivery channels — panel (in-app via notification-wc) and/or email (via /go/email).

DELETE /go/notify/subscribe/:id

GET /go/notify/subscribe

List active subscriptions.

/go/feed — Content feed

Changelog / what’s-new entries in JSON. Same data source as /rss, different format. <notification-wc> can read this for “new release” notifications; build pipelines can render both feeds from one source.

GET /go/feed

ParamTypeDefaultPurpose
sinceISO datetimeOnly return entries after this date
limitnumber20Maximum items

Relationship to /rss. /rss serves the same content as RSS/Atom for feed readers; /go/feed serves it as JSON for the notification panel and any in-app changelog component. Generate both from the same source — a CHANGELOG.md, a CMS, or a database.

/go/newsletter — Newsletter subscriptions

POST /go/newsletter/subscribe

POST /go/newsletter/unsubscribe

GET /go/newsletter/preferences

Required query param: email.

/go/email — Transactional email

Used by page-watch alerts, GoodURL digests, contact-form submissions, and newsletter welcomes. The contract is template-driven: VB names the template, the backend renders it.

POST /go/email

Template registry

VB defines named templates and the data fields each one expects. The backend implements the rendering — pick whichever templating engine you like.

TemplateData fieldsUsed by
page-watch-updatepageTitle, pageUrl, changeDescriptionPage-watch (see page-watch.md)
goodurl-digestitems, score, trendGoodURL daily digest
contact-formname, email, message, subjectContact-form submissions
newsletter-welcomeemail, listsNewsletter sign-ups

Reference implementations

None are required — the JSON shapes above are enough to write your own backend in any language. VB ships starter kits at admin/reference-implementations/:

  • Dev stub — single Node.js script with in-memory storage, seeded with sample notifications and feed entries. Run it with node admin/reference-implementations/dev-stub/server.mjs and point VBService.configure({ baseUrl: 'http://localhost:3010/go' }) at it. Wide-open CORS so it works from https://vb.test. Available now.
  • Cloudflare Worker — one Worker, one KV namespace for storage, optional Resend transport for email. wrangler deploy after replacing the KV id. Available now.
  • Express middleware — one app, four routers, pluggable storage adapter (in-memory default, Postgres example in the README), optional Nodemailer SMTP transport. npm start. Available now.

Related

/go/ Convention

The URL namespace these contracts live under, plus the VBService client that calls them.

notification-wc

Consumes /go/notify for dynamic notifications and the panel-mode unread badge.