AI-powered, multi-tenant social media automation on a single Cloudflare Worker. Generate on-brand posts with Claude, review and approve them from Telegram, and publish on a schedule to Meta (Facebook / Instagram) and X.
Public, sanitized snapshot. All real brand data, credentials, and account IDs have been removed; tenants are reduced to generic demo brands (
demo,acme,globex). Not configured to connect to any live account.
Claude (content) Telegram (human approval)
│ │
▼ ▼
┌──────────────────────────────────────────────────┐
│ Cloudflare Worker (Hono) │
│ generate → queue → approve → schedule → publish │
└──────────────────────────────────────────────────┘
│ │
▼ ▼
Supabase (state) Meta Graph API / X API
- Generate. Per-tenant brand voice, audience, and hashtags drive a Claude
prompt that drafts platform-specific copy (
src/lib/ai.ts). - Approve. Drafts land in a queue; an operator approves, edits, or rejects
them from a Telegram chat (
src/telegram/handler.ts,src/routes/accept-ui.ts). - Schedule & publish. A cron-driven publish queue posts approved content via
platform adapters (
src/adapters/meta.ts,src/adapters/twitter.ts). - Measure. Engagement stats are pulled back daily for reporting
(
src/routes/analytics.ts,src/routes/stats-ui.ts).
- Multi-tenant by slug. One Worker serves many brands via
/:slugroutes; brand config lives insrc/lib/product.ts. - AI operations layer with prompt registry, public eval shells, and a
human-in-the-loop approval model (
docs/ai/). - Database-backed workflow for tenants, prompts, drafts, queues, approvals, schedules, publish results, and analytics snapshots.
- External API adapters for model providers, Telegram, Meta Graph, X, object storage, and Supabase.
- Queue-first production shape: generation, review, publishing, retry, and reporting are separated into explicit states.
- Adapter pattern isolates each social platform behind a common interface.
- Human-in-the-loop publishing — nothing goes out without approval.
- Cron dispatcher for the publish queue and daily analytics pulls.
- R2-backed image handling for generated post media.
src/
adapters/ per-platform publishers (meta, twitter) + registry
lib/ ai, publisher, supabase, telegram, validation, date-parser
routes/ posts, campaigns, pending, accept/stats UIs, analytics, images
telegram/ bot command + approval handler
tests/ vitest unit tests
docs/ public architecture + AI operations shell
See docs/architecture.md for the sanitized database,
API, queue, and provider integration map.
npm install
cp .dev.vars.example .dev.vars # fill in your own keys
npm run dev
npm testSecrets are set with wrangler secret put in production and never committed.
See .dev.vars.example for the full list.
Source-available for portfolio / review purposes. Not licensed for redistribution or commercial reuse.