Repository map
Top level
dialer-v2/
├── app/ Next.js App Router — pages, route handlers, docs site
├── components/ React components, grouped by feature
├── lib/ All non-UI code: services, repositories, workflows, events, schemas
├── prisma/ Prisma schema, migrations, generated client, one-off SQL
├── scripts/ Operational scripts and Retell agent definitions
├── specs/ Historical feature plans (design records, not living docs)
├── docs/ Documentation: Fumadocs MDX + this Antora component
├── types/ Ambient TypeScript declarations
├── middleware.ts Route protection and email-domain gating
└── vercel.firewall.json Vercel WAF custom rules (applied with pnpm firewall:apply)
app/
| Path | Contents |
|---|---|
|
|
|
Every authenticated page; see Routes |
|
All route handlers; see API reference |
|
Fumadocs renderer for the MDX docs |
|
Theme tokens for light and dark canvases |
lib/
| Path | Contents |
|---|---|
|
|
|
Shared AI agent types |
|
|
|
BigQuery client and data-gate query builder |
|
Webhook dispatchers and handlers (Retell, Resend, Nooks) |
|
React Query hooks, one file per resource |
|
MCP JSON-RPC server, tool registry and tool implementations |
|
Phone-number purchase/release adapters (MessagingApp, Retell) |
|
Shared infrastructure clients: Inngest, Redis, Resend, SQS, HubSpot |
|
Call-target in-flight counter |
|
The only layer allowed to use Prisma |
|
Retell client wrapper, agent config, post-call analysis schema |
|
Zod schemas, one file per feature |
|
CRM event registry and template-variable interpolation |
|
Prisma → API response mappers |
|
Business logic: calling, phone selection, email campaigns, sequences, Retell agents, coverage |
|
Server/browser/admin/route-handler clients and edge functions |
|
Domain types not derived from Zod |
|
Pure helpers (timezones, area codes, masking, mapping, HubSpot signatures) |
|
Inngest durable functions |
|
App-wide constants, disposition sets, provider registry, secrets |
|
|
|
Public TypeScript types, all via |
prisma/
-
schema.prisma— every model and enum (see Data model). -
migrations/— ordered SQL migrations;migration_lock.tomlpins the provider. -
generated/— generated Prisma client (checked in; regenerate withpnpm prisma generate). -
sql/— one-off backfills and an auth hook, run manually against the database. These are historical and are not part of the migration chain; see One-off SQL.
scripts/
-
scripts/retelai/— Retell agent definitions (agents/<name>/agent.mdplusindex.ts), aregistry.tsthat is the single source of the fallback agent id/name list, andsync.tsto push definitions to Retell. -
Ad-hoc maintenance scripts (
backfill_email_click.ts,fix-hubspot-deal-to-contact.ts,test-bigquery.ts,retell_remove_numbers.ts).