Back to Docs
Architecture

How Threadline Works

A lightweight embed script, a managed API, and an optional open identity layer.

System architecturePublisher site → Embed → API → Data & identity
CLIENTSEDGESERVICESDATAPublisher siteAny platform + embed.jsReadersComment widget UIDashboard / Adminthreadline.io SSRapps/website — Next.js/api/embed · auth · sites · billing · moderation · analyticsComments API — Fastify/v1/comments · WS · ads · oEmbedTIP identity (optional)Portable reputation & exportPostgreSQLRedisStripeEmail / CDN
Website / embed host Comments API TIP identity Data & integrations

The Embed Layer

Every publisher snippet loads /api/embed, which serves the Disqus-shell widget (public/widget/embed.js). Optional ?lazy=1 uses a ~1KB IntersectionObserver bootstrap that still hydrates the same shell. It:

  • Reads your data-site-id and the current page URL
  • Renders the comment widget inside a Shadow DOM boundary (no CSS leaks)
  • Talks to the Comments API via fetch() and WebSocket — no iframe, no third-party cookies
  • Emits JavaScript events for custom integrations

The API Layer

Comment traffic goes through the Threadline Comments API (Fastify). The embed calls it from the visitor browser. Server-side tools use the same API with an API key. The website app hosts auth, sites, billing, and serves the embed bundle at /api/embed.

  • Read operations (listing comments) are public — no auth required
  • Write operations (posting, editing, deleting) require a session or API key
  • Rate limits apply per IP (anonymous) and per user (authenticated)

The Identity Layer (TIP)

Threadline uses the Threadline Identity Protocol (TIP) for portable identity and reputation. Visitors can authenticate via:

  • Your existing user system (SSO — Publisher plan and above)
  • Email magic links / password accounts (built-in)
  • Guest mode with display name

Managed vs. Self-Hosted

Managed (this service)

  • Hosted API, CDN-served embed
  • Dashboard for moderation
  • Analytics and webhooks
  • Free tier available

Self-Hosted (open source)

  • Apache 2.0 licensed TIP + reference impl
  • Full database control
  • No pageview limits on your infra
  • You operate deploy, scaling, and ops