All articles

FIELD NOTE 11

How to Vibe Code a CRM That Doesn't Break

A step-by-step build guide for teams starting fresh or leaving HubSpot or Salesforce.

Vibe-coded CRMFrom first file to launch day

Anyone can vibe code a CRM over a weekend. You describe what you want to Claude Code, and a few hours later you're dragging deals across a pipeline board that looks better than the one you pay for.

Keeping it working is another story. This guide is for building one your team still trusts a year from now.

The Screens Are the Easy Part

This stopped being an experiment the day companies started canceling real contracts. The founder of Curative, a health insurer, walked away from a $600,000 Salesforce contract after about two months of building his own. CarboNet, a 65-person water treatment company, made the Wall Street Journal for doing the same thing. Their reason is one you've probably felt yourself: the big CRMs never fit the way they sell.

Here's the catch. A CRM isn't the screen you click around in. It's the data underneath and the logic that keeps that data honest. That's where homemade CRMs crack, usually a few weeks after launch, when a lead sits unclaimed, the same list gets loaded twice, or the forecast stops matching reality.

AI will build whatever you ask for. The trick is knowing what to ask for, and in what order. That's what this guide gives you, from your first file to launch day, with a plain reason behind each step and a prompt you can hand your coding agent.

It's written for the three groups who live with the result:

  • Reps get a CRM that logs their work for them and finds any account in seconds.
  • Sales leaders get stages they can forecast on and a clear view of the whole team.
  • RevOps gets clean keys, real permissions, and a record of every change.

Before You Start

You need four things:

  • A coding agent such as Claude Code, Codex, or Hermes. Think of it as the engineer who writes the code while you describe what you want.
  • A free GitHub account. It saves every version of your CRM, so you can always roll back a mistake.
  • An owner and a backup. One person owns the build. They don't need to be an engineer, but the job can't be split. A second person should learn how it works too, because if only one person understands your CRM, their vacation becomes everyone's problem.
  • A few weeks. The first screens show up in hours. A CRM your team can trust takes steady work over several weeks, not a weekend sprint.

One idea runs through every step: the practice copy. You'll keep two versions of your CRM, a live one your team uses and a practice one where every change gets tried first. Nothing new touches live data until it works on the practice copy.

Step 0: Know Where You're Starting From

There are two ways into this, and they start in very different places.

Path A: you're leaving HubSpot or Salesforce. Start by listing everything your old CRM did without anyone noticing: email logging, duplicate blocking, sequences, reports, and who could see what. Then ask your reps which of those they actually use and which they quietly work around, because that list is half your design. Mark each item "rebuild" or "leave behind," so nothing disappears by accident.

Path B: this is your first CRM. Your data lives everywhere except one place. It's scattered across spreadsheets, inboxes, Apollo exports, and your reps' memories. The good news is that you get to design your process before a single record goes in.

Either way, both roads lead to one clean set of files.

Step 1: Prepare Your Clean Files

Your CRM will only ever be as good as the first data you load into it. So before you write a single prompt, get that data into a few spreadsheets you trust.

  • Path A: export your people, companies, deals, and activities. Keep each record's old ID so you can trace it back later.
  • Path B: pull every list into one sheet, then split it into people, companies, and deals.

Use the same column names from the start. This simple set works for most B2B teams:

companies.csv: domain, company_name, industry, owner_email, source, old_id
people.csv:    email, first_name, last_name, title, company_domain, owner_email, source, old_id
deals.csv:     deal_name, company_domain, contact_email, amount, stage, close_date, owner_email, old_id

Notice how the files connect. People and deals point to their company by its web domain, and deals point to their main contact by email. Those two columns are the glue that holds your whole CRM together.

Then clean it up:

  • Fill the keys. Every person needs an email and every company needs a web domain. Fix the rows missing one, or set them aside.
  • Merge duplicates. Two rows with the same email or domain become one. The Duplicate Tax shows what each extra record is costing you.
  • Cut dead records. Records nobody has touched in months probably don't need to make the trip. Your CRM Has an Expiration Date explains why they go bad.
  • Fix messy values. "VP Sales," "vp of sales," and "Sales VP" become one title before they reach the new system.
  • Tag the source, so you always know where each row came from.

This step is slow, and it's worth every minute. On one cleanup we ran, we found 2,643 duplicates and more than $10 million in deals the team had lost track of.

Step 2: Write the Blueprint

If you can't fit your sales process on one page, the AI will invent one for you. So write that page first.

The blueprint is a plain text file called CLAUDE.md, or AGENTS.md if you use Codex. Your agent reads it before every change, like a new hire rereading the handbook.

What follows is an example to start from, not a finished answer. Every team sells a little differently, so expect to rename, cut, and add until it matches how yours really works. The point is to make your decisions before the AI makes them for you.

Start with the fields. Most CRMs drown in them, and every extra field teaches reps to skip the ones that matter. In Article 05, we put the real number at about 15 fields kept complete every time. Here's where we'd begin:

RecordFieldWhy it earns its place
CompaniesDomain (required, unique)The key that stops duplicate companies at the door
CompaniesName, industry, sizeIndustry and size are dropdowns, so reports group cleanly
CompaniesCustomer statusProspect, customer, or former customer, so nobody pitches a current customer like a stranger
PeopleEmail (required, unique)The key that stops duplicate people
PeopleName, title, phoneWhat a rep needs before a call
PeopleRole in the dealDecision maker, champion, or influencer, so you know who signs
PeopleEmail status and last verified dateContact data goes bad fast, and these show what's still good (Article 08)
DealsAmount, stage, close dateThe three numbers every forecast rests on
DealsDate entered current stagePowers the stage clocks you'll add in Step 7
DealsClose date pushesCounts how many times a deal's close date slipped (Article 09)
DealsNext step and next step dateRequired on every open deal
DealsPain, competitor, main objectionDropdowns, not paragraphs, so you can sort and search them (Article 06)
DealsLost reasonRequired when a deal closes lost, so you learn why
ActivitiesType, date, who logged it, summaryEvery email, call, meeting, and note, tied to the right person, company, and deal
Every recordCreated, updated, owner, source, old IDWho owns it, where it came from, and how to trace it back

Then agree on your stages. Forecasts live or die on them, so settle them with your sales manager before anything gets built. Each stage needs a clear sign that a deal belongs there and a time limit. Here's the set we use with B2B sales teams:

StageWhat has to be trueTime limit
Qualified LeadThe company fits your ideal buyer, and the contact holds a target roleUnder 90 days
Scheduled First MeetingThe buyer agreed to a date and time, and the invite went outUnder 2 weeks
Completed First MeetingThe meeting actually happenedUnder 1 week
Qualified OpportunityThe buyer asked for a formal proposal, not a ballpark priceUnder 4 weeks
ProposalA meeting to walk them through the proposal is on the calendarUnder 2 weeks
Closed-WonThe buyer signedMoves to delivery

Three holding stages sit outside the forecast: Active, for interest without clear need or timing; Helpful Nurture, for a good fit with the wrong timing; and Closed-Lost, where you log the reason and check back within six months.

Now put it all in one file. Copy this example, then change anything in brackets and anything else that doesn't fit your team:

# Example CRM Blueprint (edit this to match your team)

## About us
- We sell [product] to [type of buyer].
- Team: [#] reps, [#] managers, [#] admins.
- Starting from: [HubSpot / Salesforce / spreadsheets].

## Records and fields
Every record: created date, updated date, owner, source (dropdown), old ID.

Companies
- domain (required, unique), like acme.com
- name (required)
- industry (dropdown: [list]), size (dropdown: [ranges])
- customer status (dropdown: prospect, customer, former customer)
- last verified date

People
- email (required, unique)
- first name, last name, title, phone
- company (link to Companies)
- role in the deal (dropdown: decision maker, champion, influencer)
- email status (dropdown: valid, invalid, unknown), last verified date

Deals
- name, amount (number), close date (date)
- company (link) and main contact (link)
- stage (dropdown, see Stages), date entered current stage (automatic)
- close date pushes (automatic count)
- next step and next step date (required while open)
- pain, competitor, main objection (dropdowns)
- lost reason (dropdown, required when Closed-Lost)

Activities
- type (email, call, meeting, note), date, logged by, summary
- linked to a person, company, and deal

## Stages (what has to be true / time limit)
- Qualified Lead: fits our buyer, contact holds a target role / 90 days
- Scheduled First Meeting: date set, invite sent / 2 weeks
- Completed First Meeting: meeting happened / 1 week
- Qualified Opportunity: buyer asked for a formal proposal / 4 weeks
- Proposal: walkthrough meeting is booked / 2 weeks
- Closed-Won: signed
- Holding, not in forecast: Active (4 weeks), Helpful Nurture (4 months), Closed-Lost (6 months)

## Roles
- Admin: everything, including delete and export.
- Manager: see and edit every record, export reports.
- Rep: see every record, edit their own, no delete, no export.

## Ownership
- New leads go to: [round robin / territory / source].
- A lead unclaimed after [4] hours goes to: [person or role].

## House rules for the AI
- Work on the practice copy. Ask before touching live data.
- Show me your plan before you change anything.
- One change at a time. Explain what you changed in plain English.
- Write a test for every change, and run all tests before you finish.
- Never put a password or key in the code.
- When we change a rule, update this file.

Two rules as you make it yours. First, any field with a short list of answers becomes a dropdown, never a blank text box, which is how you keep "SaaS," "saas," and "Software" from turning into three industries. Second, hold required fields to two or three per stage, because every extra box is one more reason for reps to stop updating.

This file also becomes your instruction manual, so whoever inherits the CRM can learn it in an afternoon.

Step 3: Lay the Foundation

Every CRM sits on three pieces of infrastructure: a database that holds your data, a host that puts the app online, and an email service that sends mail. You set them up once and rarely touch them again. Pick poorly, though, and every step after this one inherits the problem.

So go with tools that thousands of teams already run on. Your AI agent knows them well, their common mistakes are already solved, and help is one search away. Nobody pays us to mention the ones below.

The database is the heart of it. It's where every person, company, and deal lives, which makes it the one choice you can't easily undo. Use Postgres, the standard that most serious business apps are built on. Two companies make it easy to rent one:

  • Supabase is the easiest place to start, because it bundles the database, logins, and file storage together. The free plan gives you a 500 MB database, though it pauses a project after a week with no activity. The $25-a-month Pro plan adds daily backups, so upgrade the day your team starts relying on it.
  • Neon is just Postgres, with one standout trick called branching. It makes an instant practice copy of your whole database. The free plan includes 1 GB of storage per project and needs no credit card. Logins come separately, through Neon's own login service or a tool like Clerk.

Whichever one you choose, never run a team on a spreadsheet, an Airtable base, or a file sitting on someone's laptop.

The host puts your app on the internet so your team can reach it from anywhere. Vercel, Railway, and Render all work well. Replit makes sense if you'd rather keep everything under one roof.

The email service sends anything that leaves your CRM, from reminders to outreach. Resend and Postmark both have free starter plans, and paid plans begin around $15 to $20 a month.

Then wire it together. This takes an afternoon:

  1. Create a GitHub repository for your CRM and open it in your coding agent.
  2. Add your blueprint file to it.
  3. Create two databases, live and practice. On Neon, the practice copy is a branch. On Supabase, it's a second project.
  4. Put each database's connection details in a secrets file, usually called .env, and make sure that file never gets saved to GitHub.

Starter prompt:

Step 4: Design the Data Layer

Build the filing cabinet before you decorate the office. You can repaint the app anytime, while the structure underneath is hard to change once data lives in it.

  • Start with four tables: people, companies, deals, and activities.
  • Have the database itself refuse a second person with the same email or a second company with the same domain. A warning pop-up isn't enough, because pop-ups get clicked past.
  • Link everything to its parent, so people belong to companies and deals belong to both.
  • Store dates as real dates and amounts as real numbers, never as text. That's what lets you sort, total, and forecast later.
  • Record every stage change with the date it happened. That history is how you'll see how long deals really take and where they get stuck.

Starter prompt:

Step 5: Set Up Bulk Uploads

A simple CSV upload is the safest way to bring data in, which is why it comes before anything your team will click on. Direct tool-to-tool connections break whenever either side changes, while a file just keeps working.

A good upload page does six jobs:

  1. Matches your file's columns to the right fields.
  2. Checks each row against existing records by email or domain.
  3. Previews what will happen to every row: new, update, possible duplicate, or error.
  4. Saves nothing until you approve.
  5. Logs who ran each import, when, and how many rows changed.
  6. Lets you undo the most recent import with one click.

Now load the files you built in Step 1, in this order: companies, then people, then deals. A person can't link to a company that isn't there yet. If your record counts match the files, your foundation holds.

Starter prompt:

Step 6: Give Your Team Five Views

Four views run a rep's day, and one more runs the manager's week. Start with these five, and hold off on more until the team asks.

  1. Lists with filters you can save, plus one search bar that finds any person, company, or deal in seconds.
  2. A record page with a timeline of every email, call, and note, so a rep can catch up in thirty seconds before a call.
  3. A pipeline board where deals drag from stage to stage.
  4. A "my day" view showing each rep's tasks and stalled deals, plus a quick way to log a call from a phone.
  5. A team view for managers, showing pipeline by stage, this quarter's forecast, and stalled deals by rep, all pulled from the same data the reps see.

Ask your reps which view they open first each morning, and make that one first. Leave everything on the practice copy, and hold the link back from the team until Step 8 is done.

Starter prompt:

Step 7: Teach It Your Process

A good CRM doesn't just store your sales process. It enforces it, so good habits happen without anyone having to nag.

  • Stage clocks flag any deal that sits past its time limit. Your Pipeline Is Lying to You shows what stale deals do to a forecast.
  • Required fields keep a deal from moving forward until it has what the next stage needs. Use the two or three per stage you set in your blueprint.
  • Clear ownership rules settle who gets each new lead and who picks up one that sits unclaimed for a few hours. Write them down and share them, since they decide who gets paid.
  • Next steps give every open deal a task and a due date, so nothing quietly goes cold.

Starter prompt:

Step 8: Lock It Down

Assume someone will try the door, and lock it before they do. This is the step homemade CRMs skip most often, and the one that hurts worst when it goes wrong.

That's not a scare tactic. When Cybernews scanned apps built on Lovable, it found that 24,664 of the 34,545 projects storing data on Supabase handed over records to anyone, no login required. Here's how to make sure yours isn't one of them.

  • Logins come from Supabase Auth, Better Auth, or Clerk. Never build your own password system.
  • Permissions live inside the database. On Supabase, this is called Row Level Security. It matters because hiding a button doesn't stop anyone who knows where to look.
  • An audit log records every change: who made it, when, and what the old value was.
  • Bulk reassignment takes one click. When a rep leaves, their accounts and deals move to someone new without losing a single note.
  • Secret keys live in your host's secret settings, never in the code.
  • Backups get tested. Restore one to the practice copy so you know it works before you ever need it.

If you can, have someone who reads code look over this step before you go live. It's the one place where an expert's hour pays for itself.

Starter prompt:

Step 9: Connect Your Tools

This is where your AI agent earns its keep. Hand it the docs, and it writes the connection.

Here's how it works in plain words. Every tool has an API, which is a door other software can knock on, plus a key that opens it. Give your agent the link to the tool's docs, store the key in your secret settings, and have it build one connection at a time, on the practice copy first.

One rule covers every connection: new data passes the same email-and-domain check your upload page uses. That way, duplicates can't sneak in through a side door.

Connect your tools in this order:

  1. Email logging. The simplest version is a BCC address that reps copy on their emails, which Postmark can catch and file on the right record. The fuller version syncs Gmail directly. Keep that app set to "Internal" inside your company's Google Workspace, since Google doesn't restrict internal apps the way it restricts outside ones.
  2. Calendar, so meetings land on the record by themselves.
  3. Outbound email through Resend or Postmark, with SPF, DKIM, and DMARC set up and every unsubscribe honored. Those three settings prove to inboxes that your email really comes from you.
  4. Prospecting tools like Apollo. Start by running their exports through your upload page, and build a live connection only once you're doing it every week.
  5. Website forms, sent straight through the same duplicate check.
  6. A one-click export of everything, plus a nightly copy saved to storage you control. If you ever want to leave, your data walks out the door with you.

Starter prompt:

Step 10: Test With Real People, Then Switch

Prove it works with real people before the old system goes dark.

  • Run a dress rehearsal. Load your real files into the practice copy and have each rep check ten of their own accounts. Time how long it takes them to find one, and if it's slower than the old system, fix that first.
  • Check the counts. Companies, people, and deals in the CRM should match your files from Step 1.
  • Pick a switch day. That morning, freeze edits in the old system, export anything that changed since your clean files, and run it through the upload page into the live copy.
  • Spend 30 minutes with the team. Show reps the search bar, the "my day" view, and how to log a call. Show managers the team view.
  • Path A: keep the old CRM open as read-only for 30 days, then cancel it.
  • Path B: lock the old spreadsheets so nobody keeps a second list on the side.

Step 11: Keep It Running

A CRM is never finished, so give it a steady routine and keep your AI working on the practice copy, never live data.

  • Make one change at a time, and test each one on the practice copy.
  • Keep one shared list for change requests and review it weekly, so the CRM grows on purpose instead of one favor at a time.
  • Once a month, look over the import log and your duplicate count.
  • Set aside hours and AI budget every month, the same way you would for any other system your revenue depends on.

Know Your Line

Running your own CRM isn't a decision you make once. You make it again every month.

Watch for the warning signs: leads waiting days for an owner, tools that refuse to connect, small changes that drag on for weeks, and job candidates who lose interest when they hear you built your own. When those show up, moving to a CRM you buy is a smart call, not a failure.

The Real Work

AI made the code the easy part. Your data and your process are still the real work, and they decide whether your team trusts what you built. Get those two right, and a homemade CRM can serve you for years.

Want a second set of eyes before you build? Book a call. We also run a one-week GTM Diagnostic that gathers your data, audits it, and hands it back ready to load.

11 / GrnEdge field notes

Want a second set of eyes before you build?