Webinar close
# Webinarclose
An open-source webinar platform with a full HTTP API and an MCP server. Everything you can click, your agent can do:
create and schedule webinars, register attendees, run the live session, pull reports and a call list, draft follow-ups.
Video runs on [LiveKit](https://livekit.io); recordings and replays go to any S3-compatible bucket.
- Multi-tenant: each tenant gets API keys (`wc_live_...` / `wc_test_...`, only a sha256 hash is stored).
- Hosted registration pages, an embeddable form (`/embed.js`), an embeddable player and a public registration API.
- A host app at `/app` (dashboard, page editor, studio to go live, results).
- Mails (confirmation, reminders, replays, follow-ups) through [Resend](https://resend.com), optional.
- Billing through Stripe, optional. Without it you create tenants by hand.
- License: [AGPL-3.0](LICENSE).
## Requirements
- Node 22+ and npm
- Docker with compose (Postgres, LiveKit, Redis, egress and a local S3 bucket for development)
- For production: one Linux server with a public IP (8 vCPU / 16 GB handles about 300 viewers; recording needs
3 to 4 extra cores, see [`docs/replays.md`](docs/replays.md)), three DNS names, ffmpeg comes in the API image
## Quickstart (local, docker compose)
```sh
cp .env.example .env # set POSTGRES_PASSWORD (also inside WC_DATABASE_URL) and LIVEKIT_API_SECRET
# e.g. openssl rand -hex 16 / openssl rand -hex 32
docker compose up -d # Postgres 127.0.0.1:5450, LiveKit 127.0.0.1:7880, Redis, RustFS (S3) 127.0.0.1:9050, egress
npm ci
npm run migrate
npm run create-tenant -- "Demo" test # prints tenant_id and an API key ONCE
npm run dev # API and host app on http://127.0.0.1:3150
```
Log in at `http://127.0.0.1:3150/app` with the API key (or a magic link once mail is set up), create a webinar and
open its Studio tab to go live. The RustFS bucket in the dev stack has to exist once: create `WC_S3_BUCKET` with any
S3 client, or leave `WC_S3_ENDPOINT` empty to run without recordings.
The database variable is `WC_DATABASE_URL`, not `DATABASE_URL`: `node --env-file` never overrides a variable the
shell already has, so a generic name could quietly point the app at another database. `src/db.ts` also refuses
to connect to the server named in a shell `DATABASE_URL`.
The same flow over HTTP:
```sh
KEY=wc_test_... # from create-tenant
B=http://127.0.0.1:3150
H="Authorization: Bearer $KEY"
curl -s -XPOST $B/v1/webinars -H "$H" -H 'Content-Type: application/json' \
-d '{"title":"Close more deals","starts_at":"2030-12-01T15:00:00Z","duration_min":60,"max_viewers":20}'
W=<id from the response>
curl -s -XPOST $B/v1/webinars/$W/registrations -H "$H" -H 'Content-Type: application/json' \
-d '{"email":"ann@example.com","name":"Ann"}'
curl -s -XPOST $B/v1/webinars/$W/join -H "$H" -H 'Content-Type: application/json' -d '{"role":"host","name":"Host"}'
curl -s -XPOST $B/v1/webinars/$W/end -H "$H"
curl -s $B/v1/webinars/$W/report -H "$H"
```
The full API is in [`openapi.yaml`](openapi.yaml), also served at `/openapi.yaml`. Embeds, the public API and
mail details: [`docs/embed.md`](docs/embed.md). Data protection endpoints: [`docs/gdpr.md`](docs/gdpr.md).
### Tests
```sh
env -u DATABASE_URL npx vitest run # most suites use in-process Postgres (PGlite); some need WC_DATABASE_URL on localhost
npx tsc --noEmit
```
The test setup creates its own database per git branch on the Postgres in `WC_DATABASE_URL` (localhost only).
`scripts/e2e-local.sh` runs browser end-to-end tests against the dev stack (needs Chrome and playwright-core).
## Production on one server
`deploy/compose.prod.yml` runs Postgres, the API, LiveKit, Redis, LiveKit egress and Caddy (with
[caddy-l4](https://github.com/mholt/caddy-l4) for TURN over TLS on 443) on one host. Caddy gets Let's Encrypt
certificates by itself.
### 1. DNS
Three names, all A (and AAAA if you have IPv6) records to the server:
| Name (example) | Env var | What |
|---|---|---|
| `api.example.com` | `WC_API_HOST` | API, host app, hosted pages, embeds, `/mcp` |
| `lk.example.com` | `WC_LK_HOST` | LiveKit signalling (websocket) |
| `turn.example.com` | `WC_TURN_HOST` | TURN over TLS on 443 (viewers behind firewalls that only allow 443/TCP) |
### 2. Firewall
Open tcp 80 and 443, tcp 7881 (ICE over TCP), udp 3478 (TURN), udp 50000-60000 (media). Keep tcp 5349 closed:
Caddy passes TURN/TLS from 443 to LiveKit on 127.0.0.1:5349.
### 3. Server `.env`
Install Docker on the server and create `/opt/webinarclose/.env` (mode 600; another directory works when you set
`WC_BASE` for `scripts/deploy.sh`). Generate secrets on the server, never commit them.
| Variable | Needed | Example / meaning |
|---|---|---|
| `WC_API_HOST`, `WC_LK_HOST`, `WC_TURN_HOST` | yes | The three DNS names above, without `https://` |
| `WC_PUBLIC_NIC` | no | Network interface LiveKit offers to browsers, default `eth0` |
| `POSTGRES_PASSWORD` | yes | `openssl rand -hex 24`; the compose file builds `WC_DATABASE_URL` from it |
| `LIVEKIT_API_KEY` | yes | Any name, e.g. `wcprod` |
| `LIVEKIT_API_SECRET` | yes | At least 32 characters, `openssl rand -hex 32` |
| `LIVEKIT_URL` | yes | `wss://lk.example.com` |
| `WC_PUBLIC_URL` | yes | `https://api.example.com`: links in mails and pages, OAuth issuer, MCP snippets |
| `WC_TRUST_PROXY` | yes | `1` (Caddy sits in front; the rate limit reads the client IP from it) |
| `WC_SITE_URL` | no | Your own website. Turns on the "Hosted with Webinarclose" badge and website links on error pages. Empty: neither |
| `RESEND_API_KEY`, `MAIL_FROM` | for mail | `MAIL_FROM` like `Webinars <noreply@example.com>`, domain verified at Resend. Without the key mails queue but are not sent |
| `RESEND_WEBHOOK_SECRET` | no | Signing secret of a Resend webhook to `https://api.example.com/resend/webhook` (`email.bounced`, `email.complained`) |
| `WC_REMOTE_MCP` | no | `1` serves MCP over HTTP at `/mcp` (see MCP below) |
| `WC_HEALTH_TOKEN` | no | At least 32 characters; enables `/health/deep` for monitoring |
| `WC_MAX_CONCURRENT_VIEWERS` | no | Viewers on this server over all webinars, default 750. Load-test before relying on more than 300 |
| `WC_PLAN_MAX_VIEWERS` | no | Per plan caps, e.g. `starter=20,pro=100` |
| `WC_S3_*` | for recordings | See Recordings below |
| `STRIPE_*` | no | See Billing below |
| `WC_BACKUP_S3_ENDPOINT`, `WC_BACKUP_S3_BUCKET`, `WC_BACKUP_S3_ACCESS_KEY_ID`, `WC_BACKUP_S3_SECRET_ACCESS_KEY` | no | Off-site copies of the nightly database dump (`scripts/pg-backup.sh`) |
All other variables and their defaults are in [`.env.example`](.env.example).
### 4. Deploy
From a git checkout on your own machine (the server needs only Docker and SSH):
```sh
WC_SERVER=root@203.0.113.10 scripts/deploy.sh # ships HEAD
WC_SERVER=root@203.0.113.10 scripts/deploy.sh <ref> # any branch, tag or commit
```
Optional: `WC_SSH_KEY=~/.ssh/id_ed25519`, `WC_BASE=/srv/webinarclose`. `deploy.sh` ships the committed tree
(`git archive`) to `$WC_BASE/releases/<sha>` and runs `scripts/activate.sh` there: it builds the API and Caddy images,
sets UDP buffer sysctls (`scripts/host-tune.sh`), starts Postgres, runs migrations, renders `livekit.yaml` and
`egress.yaml`, copies the Caddyfile, starts everything and checks `https://$WC_API_HOST/health` and
`https://$WC_LK_HOST/` for 60 seconds. On success `$WC_BASE/current` points to the new release; on failure it starts
the previous release again. It refuses to run while a webinar is live (restarting LiveKit drops every viewer);
`--force` as the second argument deploys anyway.
### 5. First tenant (no Stripe needed)
```sh
ssh root@203.0.113.10 'docker exec webinarclose-api-1 node_modules/.bin/tsx scripts/create-tenant.ts "Acme" live'
```
It prints the tenant id and an API key once. Log in at `https://api.example.com/app` with that key. A tenant made
this way has no plan and billing status `manual`: it is never billing-gated, has no per-plan viewer cap (only
`WC_MAX_CONCURRENT_VIEWERS`), gets the business mail and registration caps from `src/plans.ts`, and its recordings
never expire. Create one per customer or team.
### TURN on 443
Corporate networks often allow only 443/TCP. Caddy's layer4 listener reads the TLS SNI of each connection on 443:
`WC_TURN_HOST` ends TLS in Caddy (with its own certificate) and goes as plain TCP to LiveKit TURN on 127.0.0.1:5349;
every other name goes to the normal sites. LiveKit tells browsers `turns:<WC_TURN_HOST>:443?transport=tcp`.
Plain TURN also runs on udp 3478. `scripts/turn-tls/run.sh` proves the setup locally with a relay-only browser.
### Billing (optional)
Leave `STRIPE_SECRET_KEY` empty and billing is off: the billing routes answer 503 and you create tenants with
`create-tenant`. To sell plans: create four monthly prices in Stripe, set `STRIPE_SECRET_KEY`,
`STRIPE_WEBHOOK_SECRET` and `STRIPE_PRICE_STARTER|PRO|BUSINESS` (optional `STRIPE_PRICE_SCALE`), and point a Stripe
webhook at `https://api.example.com/stripe/webhook` with `checkout.session.completed`, `customer.subscription.deleted`,
`customer.subscription.updated`, `invoice.payment_failed` and `invoice.paid`. `POST /billing/checkout {"plan":"pro"}`
then starts a Checkout session; the webhook creates the tenant and one key, which the buyer claims once at
`/billing/claim`. Refunds within 14 days, the billing gate and the daily caps are described in `openapi.yaml` and
`src/plans.ts`.
### Legal pages
Not included. The privacy policy, terms and processor agreement depend on who runs the install, so publish your
own on your website (`WC_SITE_URL`) and link them from the consent text of each registration page
(`PATCH /v1/webinars/{id}/page`).
### Backups and monitoring
- `scripts/pg-backup.sh` (run from cron on the server) writes a gzipped `pg_dump` to `$WC_BASE/backups` (7 days) and,
with `WC_BACKUP_S3_*`, an off-site copy. `scripts/restore-test.sh` restores the newest copy into a scratch database.
- `scripts/uptime-check.ts` with `deploy/wc-uptime.*` runs every minute on another machine and alerts by mail
(Resend) or webhook (ntfy, Slack) when the API, LiveKit, TURN or `/health/deep` fails.
### Upgrading
```sh
git pull
WC_SERVER=root@203.0.113.10 scripts/deploy.sh
```
Migrations in `migrations/` run on every deploy, each once, and are forward-only. To roll back, deploy the previous
commit (`ls -t $WC_BASE/releases` on the server); old code runs on the newer schema, which works because migrations
only add tables and nullable columns. To undo data changes, restore a backup.
## Recordings with any S3 bucket
Live webinars are recorded by LiveKit egress, old videos can be uploaded, and each recording gets a replay page.
The API transcodes to an MP4 master and an HLS ladder with ffmpeg. Set in `.env`:
| Variable | Meaning |
|---|---|
| `WC_S3_ENDPOINT` | S3 endpoint, path-style (AWS, Cloudflare R2, Hetzner, MinIO, RustFS, ...). Empty turns recordings off (503) |
| `WC_S3_BUCKET`, `WC_S3_KEY`, `WC_S3_SECRET` | Bucket and credentials |
| `WC_S3_REGION` | Signing region, default `auto` |
| `WC_S3_EGRESS_KEY`, `WC_S3_EGRESS_SECRET` | Optional separate key for egress uploads, scoped to PutObject on `t/*` |
| `WC_RECORDING_PURGE` | `on` (default), `dry-run` or `off` |
Keep the bucket private (browsers only get short-lived presigned URLs) and allow CORS GET, HEAD and PUT from
`WC_PUBLIC_URL`. Provider steps, retention and sizing: [`docs/replays.md`](docs/replays.md).
## MCP
Every MCP tool is exactly one `/v1` route, filtered by the key's scope (`read` < `write` < `admin`). Write tools take
`dry_run` and `idempotency_key`, destructive ones `confirm`. Details: [`docs/agents.md`](docs/agents.md).
Local (stdio), with one tenant key:
```json
{ "mcpServers": { "webinarclose": { "command": "npx", "args": ["tsx", "src/mcp/stdio.ts"],
"env": { "WEBINARCLOSE_API_URL": "https://api.example.com", "WEBINARCLOSE_API_KEY": "wc_live_..." } } } }
```
Remote (Streamable HTTP), with `WC_REMOTE_MCP=1` on the server:
```sh
claude mcp add --transport http webinarclose https://api.example.com/mcp --header "Authorization: Bearer wc_live_..."
```
With `WC_PUBLIC_URL` set, `/mcp` also supports OAuth 2.1 (discovery under `/.well-known`, dynamic client
registration, PKCE), so claude.ai and ChatGPT connectors can connect by URL alone. The host app's account page shows
ready-to-paste snippets for the install it runs on.
## Architecture
1. One Node 22 + TypeScript process: Hono for HTTP, zod for input, `postgres` for SQL, plain SQL migrations.
2. Every `/v1` query filters on the caller's tenant; another tenant's resources answer 404.
3. Each webinar is one LiveKit room. `POST /join` mints a LiveKit token: hosts publish, viewers subscribe and chat.
4. LiveKit webhooks (`/livekit/webhook`, verified) drive webinar status and attendance; each event is applied once.
5. Mails go through a database outbox and a worker in the API process.
## License
Webinarclose is licensed under the [GNU Affero General Public License v3.0](LICENSE). If you run a modified version
as a network service, you must offer its source to its users.
TDQS
Scored across 48 tools
Most tools target a distinct resource and action, and the descriptions clearly distinguish similar-looking operations. A few pairs can still be confused at a glance, such as list_registrants vs export_registrants, get_report vs get_call_list, and list_recordings vs get_recording_download.
Tool names consistently use snake_case with a verb-first pattern such as list_webinars, create_webinar, update_page, and delete_webhook. Minor exceptions like watch_live and get_health remain clear and do not break the overall convention.
The 48-tool surface is very large and exceeds a comfortably scoped MCP server, with many granular live-control, reporting, email, key, and webhook tools. Several could be consolidated or grouped without losing functionality, increasing cognitive load for an agent.
The server covers the main webinar lifecycle well: scheduling, registration, pages, emails, live events, reports, recordings, webhooks, keys, account settings, and audit. There are still some gaps, such as no explicit start_webinar, no update_webhook, no poll listing, and read-only recording management, but most workflows have workarounds.