Skip to content

Claude/crm architecture analysis 1x33dx - #95

Closed
zaynrahman005-beep wants to merge 9 commits into
trycompai:mainfrom
zaynrahman005-beep:claude/crm-architecture-analysis-1x33dx
Closed

Claude/crm architecture analysis 1x33dx#95
zaynrahman005-beep wants to merge 9 commits into
trycompai:mainfrom
zaynrahman005-beep:claude/crm-architecture-analysis-1x33dx

Conversation

@zaynrahman005-beep

@zaynrahman005-beep zaynrahman005-beep commented Aug 8, 2026

Copy link
Copy Markdown

Summary by cubic

Adds an agency CRM layer: client accounts, SMS inbox via Twilio, lead‑capture forms with public submit, workflow automation scaffold, and a Kanban board for deals. Updates the dashboard KPIs and sidebar to surface the new features.

  • New Features

    • Client accounts: CRUD, status filter, and scoping across contacts/companies/deals/forms/workflows.
    • Deals board: Kanban view with drag‑and‑drop reordering; persisted boardOrder.
    • SMS: Twilio send/receive, signed inbound webhook, unread counts, and SMS activities. New Inbox UI and TRPC routes.
    • Forms: builder UI, publish/archive, public GET/POST by slug that finds/creates contacts and files FORM_SUBMISSION activities.
    • Workflows: definitions with triggers and JSON steps; runs scaffold and list/Create UI.
    • Dashboard: KPI strip (clients, unread inbox, active workflows, published forms).
    • Nav: new Clients, Inbox, Forms, and Workflows sections.
    • DB: adds ClientAccount, SmsThread/Message, Form*, Workflow* models; clientAccountId and tags on core records; new ActivityType values SMS, FORM_SUBMISSION, WORKFLOW.
  • Migration

    • Run Prisma migrate to apply 20260808120000_zayn_scales_agency.
    • Optional SMS setup: set TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, plus TWILIO_FROM_NUMBER or TWILIO_MESSAGING_SERVICE_SID; expose POST /internal/sms/inbound publicly and point Twilio to it.
    • packages/db no longer requires DATABASE_URL for prisma generate; keep it set for migrate/seed/runtime as usual.

Written for commit 109e4c9. Summary will update on new commits.

Review in cubic

carhartlewis and others added 9 commits August 7, 2026 11:38
Turns the existing agent-first CRM into an internal agency platform:
- ClientAccount as first-class entity; every record can be scoped to
  which agency client it belongs to without breaking single-tenant.
- SMS via Twilio: threads, unified inbox UI, signed inbound webhook,
  SMS activities.
- Forms: builder + public submit endpoint that finds-or-creates
  contact and fires a FORM_SUBMISSION activity.
- Workflow automation scaffold: triggers, JSON step list, WorkflowRun
  queue (runner still to build).
- Deals: Kanban board view (?view=board) with drag-drop reorder.
- Overview: agency KPI strip (clients / unread inbox / live workflows
  / published forms).
- Sidebar rail: Clients, Inbox, Forms, Workflows.

Prisma migration 20260808120000_zayn_scales_agency adds ClientAccount,
Sms*, Form*, Workflow*, Booking* models plus clientAccountId/tags on
Company/Contact/Deal, boardOrder on Deal, and new ActivityType values
SMS/FORM_SUBMISSION/WORKFLOW.

Adds TWILIO_* env vars (all optional, capability-off pattern).

Verified: api/app typecheck, api/app lint, 119 app tests pass. API
tests that hit the DB fail with DatabaseNotReachable — expected in
this container.

See adrs/zayn-scales-agency-crm.md for the full log of what shipped,
design decisions, and the honest not-done list.
The postinstall script runs 'prisma generate', which only needs the
schema — it doesn't connect to the database. But 'prisma.config.ts' was
calling 'env("DATABASE_URL")' from '@prisma/config', which throws
'PrismaConfigEnvError: Cannot resolve environment variable' at config
load whenever DATABASE_URL is unset. On Vercel's install phase this
fails the whole 'bun install' because postinstall exits 1.

Use 'process.env.DATABASE_URL' directly and pass 'datasource'
conditionally, so the URL is resolved lazily and only when actually
needed by migrate/seed commands. Generate now succeeds without any
DATABASE_URL, migrate keeps working with it set.

Verified locally:
- 'bun install' with no .env and DATABASE_URL unset — passes
- 'prisma generate' with DATABASE_URL unset — passes
- 'prisma migrate status' with a real DB — reports 38 migrations
  applied
- api build — passes
- api/app check-types — pass
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

@claude is attempting to deploy a commit to the Comp AI - PoC Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
github-actions Bot changed the base branch from release to main August 8, 2026 18:09
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Retargeted this onto main.

release is the default branch so that a plain clone runs the last tagged release, but nothing merges into it — it is fast-forwarded onto the tag by the Release workflow and that is all. Changes go to main, and reach release when a release is cut.

Nothing is wrong with your branch. If the diff now shows commits that are already on main, rebase and force-push:

git fetch origin main
git rebase origin/main
git push --force-with-lease

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants