PLG Bridge — self-serve to enterprise

An agent that watches self-serve product usage, scores accounts for enterprise readiness, and delivers an AE-ready package per account: brief, buying-committee map, draft outbound email, and a 45–60 s voice briefing.

What it does

  • Ingests usage (events, seats, feature hits, API calls, plan-limit events) from streaming or batch sources, including Nexla webhooks.
  • Clusters users into accounts by email domain, skipping personal-email domains, de-duping against CRM records.
  • Scores every account on 5 weighted signals — seat growth, power-feature depth, admin activity, collab density, plan-limit proximity — and surfaces the top-3 contributing signals for explainability.
  • Triggers autonomous research when an account crosses a configurable threshold (per-account cooldown enforced).
  • Gathers public signals (funding, headcount, leadership, tech stack) via Tinyfish, structures the output with Bedrock, caches results.
  • Identifies the champion from usage (admin + invites + power-feature adoption) and maps a 3–5-person buying committee.
  • Drafts a ≤150-word brief + a personalized email where every sentence is grounded in a concrete usage signal.
  • Produces a 45–60 s voice briefing via Vapi.
  • Delivers via dashboard, Slack webhook, and a public GET /api/briefs/:id for CRM sync.

Every integration falls back to a deterministic mock when its credentials are missing, so the system runs end-to-end with zero external keys.

Sponsor wiring

Sponsor Where it's used
AWS Bedrock src/lib/integrations/bedrock.ts — retrying client, Zod-validated JSON for committee, brief, email.
Nexla src/app/api/ingest/nexla/route.ts — normalizes Nexla event payloads into our UsageEvent shape.
Redis src/lib/redis.ts — accounts, users, events, scores, cooldown locks, pub/sub, activity, metrics, config.
Tinyfish src/lib/integrations/tinyfish.ts — public-signal research, 24-h cache.
Vapi src/lib/integrations/vapi.ts — voice brief.
Chainguard Dockerfile + Dockerfile.worker — hardened base images.

Run it locally

# 1. Install
npm install

# 2. Start Redis (or set REDIS_URL to a managed instance)
docker run -p 6379:6379 -d redis:7

# 3. Either:
#    (a) click "Seed demo data" in the UI, or
#    (b) load fixtures from the CLI:
npm run fixtures:generate
npm run fixtures:seed

# 4. Dashboard
npm run dev          # http://localhost:3000

# 5. Async research worker (optional — the dashboard can also assemble inline)
npm run worker:research

Containers

cp .env.example .env
docker compose up --build

Smoke test

npm run smoke   # seeds, simulates, forces a brief, asserts all pieces exist

Endpoints

Ingestion

  • POST /api/events — single UsageEvent or { events: [...] }.
  • POST /api/ingest/nexla — Nexla webhook format.

Accounts

  • GET /api/accounts — every account ranked by readiness.
  • GET /api/accounts/:domain — full account (account, score, users, events, score history, latest brief).
  • GET /api/accounts/:domain/activity?limit=N — agent activity log.
  • POST /api/accounts/:domain/trigger?mode=inline|async&force=true — regenerate a brief.
  • POST /api/accounts/:domain/simulate — demo simulator ({ intensity: "light" | "burst" | "expansion" }).

Briefs

  • GET /api/briefs?limit=N — recent brief packages.
  • GET /api/briefs/:id — full brief package (for CRM sync).
  • GET /api/briefs/:id/markdown — downloadable .md export.
  • GET /api/briefs/:id/feedback — AE feedback (status + note).
  • POST /api/briefs/:id/feedback — { status, note }.
  • GET /api/briefs/stream — SSE channel, pushes brief_ready events.

Config + admin

  • GET /api/config — live scoring threshold + cooldown.
  • POST /api/config — patch ({ threshold?, cooldownDays? }).
  • GET /api/health — Redis status + configured sponsors.
  • GET /api/metrics — counters (briefs today, triggers today, avg time to brief).
  • POST /api/admin/seed — one-click demo seed.
  • POST /api/admin/trigger-all — bulk recompute + research above a min score.

Dashboard

  • Home — overview stats, readiness histogram, top movers, live trigger config, filtered + searchable account table with sparkline trends.
  • Account detail — score badge, plan-pressure badge, CRM badge, demo simulator, brief card (with AE status + markdown export + copy email), signals trend chart, champion, committee, research, email + voice, activity timeline, recent events, brief history, CRM record.
  • Briefs — all generated brief packages, newest first.
  • Activity — global agent activity feed.
  • Light mode only. Live toast when any new brief lands (via SSE).

Non-functional requirements — status

  • [x] Research for a single account completes in under 60 s (parallel fan-out + 24-h research cache).
  • [x] Scoring updates in < 10 s from event ingest (synchronous in the ingest handler).
  • [x] All LLM outputs are structured JSON validated against a Zod schema.
  • [x] Containerized with Chainguard base images.

Built With

Share this project:

Updates