Add-on Development Guide

Streamix ships as one codebase with 63 bundled add-ons under src/product/addons/<id>/: 54 channel integrations (payments, email, SMS, WhatsApp, social login, captcha, analytics, live chat, chatbot, calendar, video…) and 9 feature plugins (announcements, API, audit logs, digest, maps, web push, SSO, two-factor auth, webhooks). There is nothing to upload; licensing and an admin toggle decide what is usable.

This guide covers channel add-ons, using the Stripe payment gateway (src/product/addons/payments-stripe/) as the example. Feature plugins are covered in the Plugin Development Guide.

What a channel add-on is

A channel is a job the platform delegates to a provider:

Channel Used by Streamix for
payments Subscription checkout and renewals (PaymentDriver)
storage Artwork, video, subtitles, HLS output (built-in providers: R2, Spaces, S3, GCS)
email Verification and sign-in codes, billing and lifecycle emails
sms, whatsapp Notification templates
social "Continue with Google/Facebook"
captcha Sign-in and form protection
analytics Tag injection after cookie consent
chat, livechat, chatbot Support widgets and AI helpers
video Embed providers from the shared core (YouTube, Vimeo, Mux, Cloudflare Stream, Bunny). The Streamix player does not use them yet; it plays HLS/MP4 URLs.

Anatomy

TEXT
src/product/addons/payments-stripe/
  addon.json            manifest
  index.ts              exports `channel` (ChannelDef) and `driver`
  stripe.ts             ProviderDef: credential fields and setup steps
  driver.ts             PaymentDriver: create / verify
  installation-guide.md shown in the admin

Manifest (addon.json)

JSON
{
  "id": "payments-stripe",
  "name": "Payments — Stripe",
  "channel": "payments",
  "provider": "stripe",
  "version": "1.0.0",
  "type": "code",
  "premium": true,
  "serverAdapters": { "payment": "driver" },
  "products": ["*"],
  "vendor": "creative-cape.com"
}
Field Meaning
id Unique id, same as the folder name
channel / provider Which channel it joins and the provider it adds
serverAdapters / clientAdapters Adapter kind → export name wired in at bundle time
premium Gated by license entitlement or a purchase code
products ["*"] for every product, or specific product ids ("streamix")

ChannelDef and ProviderDef

TS
// index.ts
import type { ChannelDef } from "@/core/channels/types";
import type { PaymentDriver } from "@/core/payments/types";
import { CreditCard } from "lucide-react";
import { stripe } from "./stripe";
import { stripeDriver } from "./driver";

export const channel: ChannelDef = {
  id: "payments",
  label: "Payments",
  desc: "Collect payments at checkout.",
  icon: CreditCard,
  tint: "bg-violet-50 text-violet-600",
  providers: [stripe],
};
export const driver: PaymentDriver = stripeDriver;

The ProviderDef lists the fields an admin fills in (text, secret, select) and optional setup steps. secret fields are encrypted at rest (AES-256-GCM with SECRET_KEY) and masked in API responses.

Payment driver contract

src/core/payments/types.ts defines PaymentDriver:

  • method(config) builds the buyer-facing tile (never include secrets).
  • create(ctx) starts a payment for an amount the server computed (ctx.amountCents, ctx.currency) and returns one of: { kind: "redirect", redirectUrl, ref }, { kind: "modal", modal, ref } (in-page widget), { kind: "form_post", actionUrl, fields, ref }, or { kind: "offline", message }. Return null on a provider or configuration error.
  • verify(ctx) confirms the payment with the provider ({ paid, ref }). Streamix activates or extends a membership only after verify succeeds, and (provider, provider_ref) is unique so a payment cannot be applied twice.

Streamix charges per period: each renewal is a new create/verify round. Drivers do not need to store cards or run provider-side subscriptions. (Automatic recurring charging is on the roadmap and would need provider subscriptions and webhooks.)

Built-in drivers: cod (cash, offline), bank (bank transfer, offline), paypal (redirect). Premium payment add-ons: Stripe, Razorpay, PayU, Square, Mollie, Paystack, Flutterwave, Mercado Pago, Xendit, Airwallex, Authorize.Net, Checkout.com, Coinbase Commerce, dLocal, eWAY, PayTabs, Tap, Telr, Viva Wallet and Yoco.

Registration

You never edit registries by hand. The bundler scans src/product/addons/*/addon.json and regenerates:

  • src/product/addons/index.ts → ADDON_CHANNELS
  • src/product/features/index.ts → ADDON_FEATURES
  • src/product/adapters-server/index.ts → ADDON_SERVER_ADAPTERS
  • src/product/adapters-client/index.ts → ADDON_CLIENT_ADAPTERS

src/core/channels/registry.ts merges built-in channels with ADDON_CHANNELS; providers of the same channel appear under one card. src/core/payments/registry.ts combines built-in drivers with serverAdapters("payment").

Terminal
npm run addons:bundle    # regenerate the indexes
npm run addons:catalog   # write docs/add-ons/catalog.json for the store

Run both after adding, removing or changing an add-on.

Licensing

Free providers (no key needed): email:smtp, analytics:ga4, payments:cod, payments:bank, payments:paypal, storage:r2, video:youtube, video:vimeo (src/core/channels/tiers.ts). Everything else is premium.

premiumBlock() in src/lib/premium.ts allows a premium provider when:

  1. the license entitlements include */all, the channel id, or <channel>:<provider>; or
  2. a purchase code for that add-on has been activated for the domain.

On local development hosts (not in production builds) everything is unlocked for testing.

Connecting in the admin

Configuration → Add-ons (/admin/settings/integrations):

  • Connect a provider by filling its fields; the connection is stored in integration_connections with an active flag and, per channel, a default.
  • Enter a purchase code to unlock a premium provider not covered by the main license.

For payments, a gateway appears at checkout only when it is both connected/active and has a registered driver.

Checklist for a new channel add-on

  • Folder and addon.json with a unique id
  • ProviderDef fields and setup steps; secrets marked secret
  • Driver/adapter implementing the channel's contract; never trust client amounts
  • installation-guide.md for admins
  • npm run addons:bundle and npx tsc --noEmit
  • Tested end to end: connect, use, disconnect

© CreativeCape Solutions · creative-cape.com · support@creative-cape.com