# Production checklist

URL: https://docs.folkways.io/docs/guides/production-checklist

What to check before going live with Folkways, how to process critical events reliably, and how to troubleshoot common problems.

## Before you go live [#before-you-go-live]

### Security [#security]

- [ ] Private signing keys and service tokens live only on your servers, in a secrets manager.
- [ ] Your token endpoint is behind your login, and derives the identity and capabilities from the user's session.
- [ ] Tokens grant only the topics and operations each user needs, and live 10 minutes or less.
- [ ] Private rooms use **Members only** rules, not hard-to-guess names.
- [ ] Payloads are validated where you receive them; no secrets in topic names, event names or headers.
- [ ] Your app clears local data on sign-out (`close({ clear: true })` in the JavaScript SDK).
- [ ] You have rehearsed rotating a signing key, and kicking and revoking a user.

### Reliability [#reliability]

- [ ] Your database, not Folkways, is the record of truth for messages, orders and payments.
- [ ] You save the last processed cursor per topic, and handle gaps by fetching from your backend.
- [ ] Event effects are idempotent: a duplicate delivery or a retried publish changes nothing.
- [ ] Your UI shows the connection state, and doesn't auto-reconnect after `Replaced` or `AuthRevoked`.
- [ ] You have tested: going offline, reloading during a replay, many tabs, token refresh, a full publish queue, a
  slow consumer and a service restart (clients get `Draining`).

### Capacity [#capacity]

- [ ] You have measured your real fan-out, payload sizes and publish rates, including a reconnect storm after an
  outage.
- [ ] Your package's allowances and the segment's [rate preset](/docs/console/segments#rate-preset) fit that load,
  with headroom. Set [monthly caps](/docs/console/segments#monthly-caps) per segment if one app shouldn't starve the
  others.
- [ ] Staging and production are separate segments, with separate keys.
- [ ] Your SDK version is pinned, and you have tested an upgrade with older clients still connected.

## Processing critical events reliably [#processing-critical-events-reliably]

A publish receipt isn't a database transaction. For an order, a payment or any change that matters:

1. Validate and authorize the request in your backend.
2. Store the change, with your own operation ID, in your database.
3. Publish the event with a stable idempotency key, from a worker that reads an outbox written in the same
   transaction. If the worker crashes after the publish, it retries with the same key.
4. Make receivers idempotent by your operation ID: the deduplication window is 10 minutes, so a later retry can be
   delivered again.

After a gap, reconcile from your database rather than guessing what was missed. Don't use presence to authorize
anything, signal delivery as proof that something happened, or KV as a transaction store.

## Troubleshooting [#troubleshooting]

See [Troubleshooting](/docs/guides/troubleshooting), which goes through common problems by symptom.
