folkwaysDocs
Concepts

How Folkways works

The parts of Folkways, who talks to which, and the words the rest of the docs use.

Folkways has three public surfaces, and your code talks to two of them:

SurfaceAddressWho uses itFor
Consoleconsole.folkways.ioYou and your team, in a browserWorkspaces, packages, segments, keys, topic rules, team, usage
Realtime APIYour segment's Realtime URL, from its Connect tabYour apps and your backendConnecting, publishing, subscribing, presence, members, DMs
Platform APIhttps://api.folkways.io/api/v1Your servers, with an API keyReading your workspace, segments and usage
You set up a workspace, segments, keys and topic rules in the Console. Your backend holds the private signing key and gives each signed-in user a token. Your app connects to the Realtime API with that token to publish and subscribe. Your backend can also publish, manage members and open DMs with a service token, and read usage from the Platform API with an API key.

The flow

  1. You set up a segment in the Console: a signing key, so your backend can sign tokens, and topic rules, which say which topics exist and what they carry.
  2. Your backend signs a token for each signed-in user. The token names the segment, the user and what they may do. Signing happens in your process with your private key; Folkways never sees that key.
  3. Your app connects to the Realtime API with the token, then publishes and subscribes to topics. Folkways checks every operation against the token and the topic's rule.
  4. Your backend can act too, with a service token: publish events, manage who may use a private topic, open direct-message rooms, disconnect a user.

The building blocks

ConceptIn one lineRead more
WorkspaceYour team's account: one package, its segments, team and billingWorkspaces and segments
SegmentOne isolated app in one environmentWorkspaces and segments
Identity and tokenWho a connection is, and what it may doIdentities and tokens
TopicA named channel, e.g. rooms/42, matched by a topic ruleTopics
EventOne published item: a name, a type and a payloadEvents
Stream, KV, Signal, PresenceHow events are kept and deliveredPrimitives
CursorAn event's position in a stream, for resumingDelivery and ordering
ConnectionA WebSocket or HTTP session with the Realtime APIConnections

None of these depend on an SDK. The JavaScript SDK wraps them, and any language can use the Realtime API directly.

On this page