Seu Milhão is a Brazilian prize-draw brand. It sells through partner bars, individual affiliates and sports teams, and runs its own traffic, CRM, support and finance. This page maps the single system that runs all of that. I designed it and built it with Claude Code as my pair programmer, from August to November 2026.
One React build serves everyone. Each audience gets its own mount point, session and permissions. Isolation between them is enforced by tests, not by convention.
The grid mirrors the real panel home. Click a module to see what it does, its screens, its API surface and where its code lives.
Every sale is attributed to whoever originated it. The system turns that attribution into commission, then into a payout, then into a finance entry.
The AI works in narrow lanes, each with a written rule about what it may touch.
Reads an open support conversation and suggests type, root cause, urgency and a one-line summary.
Talks to people in private chat and guides them to purchase.
Incoming voice notes are transcribed so the bot and human agents can read them. Outgoing audio is converted to Telegram voice format with ffmpeg.
I directed and decided; Claude Code wrote code against rules kept in the repo. The rules are what keep a large codebase coherent when most of it is written with AI.
AGENTS.md holds the engineering rules Claude Code must follow, for example: no hand-written colors, dates in one timezone helper, no PII in AI calls.
ESTADO.md records why each decision was taken, with the date. New sessions read it first, so nobody reopens a settled decision.
A single npm test chain runs 134 scripts. They cover the business rules, and also the architecture: one portal can't reach another's data, imports resolve, hooks run in order, and numbers on screen match the database.
216 numbered SQL files and no edits to old ones. Two Postgres schemas share one database: the existing sales schema is read-only from here.
Built to be resold: each client company gets its own database, processes, domains and credentials, created and published with one command each.
Each panel lives in web/src/paineis/<audience>/<panel>/ (screens) and src/paineis/<audience>/<panel>/ (server), each with its own read-me. The map below shows which panels have moved.
browser — React 19 SPA (Vite, Tailwind 4), one build, routed per audience
│
Fastify 5 API (Node 20, ESM)
│
┌──────────────────────────┼───────────────────────────┐
│ │ │
scheduler / workers integrations PgBouncer
commission · daily stats WhatsApp (QR + official API) │
CRM journeys · conversions Telegram bots · Meta Ads PostgreSQL 16
support triage · ad cost Anthropic · OpenAI Whisper schemas: bares | crm
watchdog web push · PDF contracts
Each module's code location now, its API surface and whether it has been moved into the folder layout. Full map: docs/de-para.md.
| Module | Route | Screens (front) | Server | API | Layout |
|---|