emerald-a

byREVANTH KRISHNASWAMY

Build a simple multi-tenant CRM SaaS. Ship a working vertical slice, not a scaffold. MULTI-TENANCY (non-negotiable, implement first) - Shared database, shared schema, TenantId column on every tenant-owned table - TenantId resolved from the auth token, never from request body or query string - Tenant filtering applied automatically at the data-access layer, not repeated by hand in each query - TenantId stamped automatically on insert - Include one integration test proving tenant A cannot read tenant B's rows DOMAIN (v1 scope — build exactly these, nothing more) - Tenant: name, slug, created date - User: email, password hash, TenantId, role (Owner | Admin | Rep) - Company: name, domain, industry, owner (User) - Contact: first/last name, email, phone, title, CompanyId (nullable), owner - Deal: title, value (decimal), currency, CompanyId, primary ContactId, StageId, expected close date, owner, status (Open | Won | Lost) - Stage: name, sort order, default win probability, TenantId (seeded per tenant: Lead, Qualified, Proposal, Negotiation, Closed) - DealStageHistory: DealId, from stage, to stage, changed by, changed at (written on every stage move — needed for funnel reporting later) - Activity: type (Note | Call | Meeting | Task), subject, body, due date, completed flag, owner, and nullable ContactId / CompanyId / DealId All tables get: Id (UUID), CreatedAt, CreatedBy, UpdatedAt, UpdatedBy, IsDeleted (soft delete, filtered out globally). PERMISSIONS - Owner/Admin: see and edit all records in the tenant - Rep: see all, but edit only records they own - Enforce centrally in one authorization layer, not scattered through handlers API - REST, /api/v1/*, cursor pagination, filtering and sorting on list endpoints - Full CRUD for companies, contacts, deals, activities - PATCH /deals/{id}/stage — moves stage and writes history in one transaction - GET /dashboard/summary — open pipeline value, count by stage, deals closing in next 30 days, activities overdue - Consistent structured error responses, server-side validation on all inputs - Auth via access + refresh tokens FRONTEND - Signup creates tenant + owner user in one flow; invite users by email - Contacts and Companies: list with search and inline create - Deals: kanban board by stage with drag-and-drop (calls the stage endpoint, optimistic update, rollback on failure) plus a table view toggle - Deal detail: summary, linked contact/company, activity timeline, add note - Dashboard from the summary endpoint EXPLICITLY OUT OF SCOPE — do not build Email sync, calendar sync, telephony, custom fields, workflow automation, imports, marketing features, billing, mobile app, real-time updates. SCALE ASSUMPTION Hundreds of tenants, tens of thousands of records each. Do not build sharding, event sourcing, CQRS, or microservices. One database, one API. DELIVERABLES, IN ORDER 1. Schema: entities, relationships, initial migration, seed data 2. Tenancy plumbing + the isolation test — confirm this passes before moving on 3. Auth: signup, login, refresh, invite 4. CRUD endpoints with validation 5. Frontend, screen by screen 6. README: local setup, environment config, migration and seed commands Work through the deliverables in order. After each one, stop and show me what you built before continuing.

LandingAuthenticationSignup
Landing

Comments (0)

No comments yet. Be the first!

Signup design preview
Landing: Owner/Admin visits the public landing page
Signup: Owner/Admin completes registration form creating tenant and owner user
Authentication: Owner/Admin logs in with credentials
CRM Dashboard: Owner/Admin views dashboard summary
CRM Dashboard: Owner/Admin invites a user by email
CRM Dashboard: Owner/Admin searches and inline creates contacts and companies
CRM Dashboard: Owner/Admin drags a deal card to a new stage on the kanban board
CRM Dashboard: Owner/Admin opens deal detail and adds an activity note
CRM Dashboard: Owner/Admin action denied outside tenant authorization
Landing design preview
Landing: Owner/Admin visits the public landing page
Signup: Owner/Admin completes registration form creating tenant and owner user
Authentication: Owner/Admin logs in with credentials
CRM Dashboard: Owner/Admin views dashboard summary
CRM Dashboard: Owner/Admin invites a user by email
CRM Dashboard: Owner/Admin searches and inline creates contacts and companies
CRM Dashboard: Owner/Admin drags a deal card to a new stage on the kanban board
CRM Dashboard: Owner/Admin opens deal detail and adds an activity note
CRM Dashboard: Owner/Admin action denied outside tenant authorization