Back to Blog
aitechnicalcase-study

I Built a Full AI-Powered CRM in One Session with Claude Code

How I ported 1,500 lines of Python to a production Next.js SaaS app in a single coding session — database, auth, AI email engine, and all.

By Mike Hodgen

The Python CLI That Outgrew Its Shell

For the past few weeks, I've been running my outreach pipeline from a Python CLI tool I call hodgen-ops. It works. Type a command, audit a Shopify store, score the lead, compose a personalized email with Claude, send it through Resend. All from the terminal.

But it had a problem. The "database" was a JSON file. The "UI" was print statements. And if I wanted to share it with anyone — a teammate, a client, a future customer — they'd need to know Python, install dependencies, and navigate a CLI.

I needed a real product. A web app with auth, a database, a dashboard, a pipeline view. Something that looked and worked like the SaaS tool I'd been promising on the Flowline landing page.

So I sat down with Claude Code and built the entire thing in one session.

What Got Built

Flowline is an AI-native CRM for Shopify brands. It finds stores, audits their SEO, scores them as leads, writes personalized outreach emails, and tracks the full pipeline from discovery to close.

The stack:

  • Next.js 16 with App Router and TypeScript
  • Supabase for auth, Postgres database, and row-level security
  • Claude (via the Anthropic SDK) for email composition
  • Cheerio for Shopify store scraping (ported from BeautifulSoup)
  • Resend for email delivery
  • Vercel for hosting

The final app has 21 API routes, 8 pages, a kanban pipeline board, a 4-pillar audit scoring engine, a 3-email AI sequence composer, workspace settings, CSV export, bulk operations, and a Resend webhook for open/click tracking.

Total codebase: 5,787 lines across 49 files. All type-safe TypeScript.

The Python-to-TypeScript Port

The core engine — store fetching, auditing, scoring, email composition, and delivery — was 1,485 lines of Python spread across 8 files. The port to TypeScript came out to about 1,020 lines across 5 engine files.

Before and after comparison showing the migration from hodgen-ops Python CLI with JSON file storage to Flowline production web app built with Next.js, Supabase, Claude API, Cheerio, Resend, and Vercel — mapping each Python library to its TypeScript equivalent and showing the growth from 1485 lines across 8 files to 5787 lines across 49 files Python CLI to Production SaaS Architecture

Here's what changed in translation:

BeautifulSoup to Cheerio. The scraping logic was the most involved port. BeautifulSoup's API is forgiving — you can chain .find() calls without worrying much about nulls. Cheerio is stricter. Every selector chain needs null checks. But the jQuery-like API made the actual selectors almost identical.

requests to fetch. Python's requests library handles redirects, timeouts, and headers in one call. The native fetch API does too, just with different syntax. No library needed.

anthropic Python SDK to @anthropic-ai/sdk. Nearly identical APIs. The TypeScript SDK uses the same messages.create() pattern. The prompt structure, system messages, and response parsing transferred directly.

resend Python to resend TypeScript. Same story. The Resend SDK is consistent across languages. The send function ported in about 10 minutes.

JSON file to Supabase. This was the real upgrade. The Python tool stored everything in a single leads.json file — 25 leads with nested audit data, scores, drafts, and notes. The Supabase schema normalized this into 7 tables with proper indexes, foreign keys, and row-level security.

The 4-Pillar Audit Engine

The scoring system analyzes four dimensions of a Shopify store, all from publicly available data:

Infographic explaining the 4-pillar audit scoring engine: Product Descriptions scored by word count thresholds, Meta Tags checking title and OG tags with critical flags, Blog Health measuring post quality and structure, and Page Structure evaluating JSON-LD and social data — all feeding into a composite score from 0 to 100 with a prime outreach zone of 45 to 55 4-Pillar Audit Scoring Engine

Product Descriptions — Fetches /products.json and scores description quality by word count. Empty descriptions score 0, thin (under 50 words) score 3, good (50-350 words) score 8, long (350+) score 9. Each threshold came from real patterns I noticed across hundreds of stores.

Meta Tags — Checks the homepage for title tags, meta descriptions, and Open Graph tags. Missing meta description is flagged as critical — it's the single highest-impact SEO fix most stores can make.

Blog Health — Detects blog presence, counts posts, then samples individual articles for word count, heading structure, and internal links. Most Shopify stores have a blog. Most of them are thin. That's an opportunity.

Page Structure — Looks for JSON-LD structured data, social profiles, and complete OG tags. Stores with Organization and WebSite structured data tend to rank better. Most don't have it.

Each pillar scores 0-10. The composite score factors in store size (log scale), problem severity, opportunity (inverse of current score), and a revenue tier multiplier. A store with 200 products, critical SEO issues, and mid-tier revenue lands around 45-55 — prime outreach territory.

AI Email Composition

The email engine generates a 3-email sequence for each lead:

Vertical flowchart showing the 3-email AI outreach sequence: audit data and brand voice feed into Claude AI composer, which generates Day 0 Value First email under 150 words, Day 3 Pure Value email under 100 words, and Day 7 Soft Close email under 80 words — full sequence generated in approximately 8 seconds and output as JSON wrapped in branded HTML 3-Email AI Outreach Sequence

Day 0 — Value First. Opens with a specific, actionable tip pulled from the audit data. References real numbers. Mentions one relevant credential naturally. Ends with a soft question: "Want me to send over the full audit?"

Day 3 — Pure Value. Shares a second tip. No pitch, no ask. Just something they can implement in under 30 minutes. This builds trust.

Day 7 — Soft Close. Acknowledges they're busy. References the value shared. Offers a Calendly link. No urgency, no guilt.

Each email is composed by Claude with a system prompt that includes my brand voice, credentials, and ICP definition. The prompts are specific: under 150 words for Day 0, under 100 for Day 3, under 80 for Day 7. Claude returns JSON with subject and body. The engine wraps the plain text in a branded HTML template for deliverability.

The whole sequence generates in about 8 seconds.

What Claude Code Actually Did

I want to be specific about what "built it in one session" means. I didn't just type "build me a CRM" and walk away.

Flowchart showing the 5-phase build process for Flowline CRM: Phase 1 Setup Auth and Database, Phase 2 Lead Management, Phase 3 AI Engine Port, Phase 4 Email System, Phase 5 Dashboard and Polish — each ending with a clean build checkpoint, all completed in one session 5-Phase Build Process

The process was structured into 5 phases:

  1. Project setup, auth, database — Scaffolded Next.js, configured Supabase clients (browser, server, service role), built login/signup pages, wrote the full SQL migration with RLS policies, created the auth middleware.

  2. Lead management — TypeScript types, CRUD API routes, CSV/URL import, leads table with search and filtering, kanban pipeline board.

  3. AI engine — Ported all 5 engine files from Python. Fixed TypeScript-specific issues (literal type inference, cheerio type mismatches, regex flag compatibility).

  4. Email composition and delivery — Ported brand voice, compose engine, send engine. Built the API routes for compose and send. Added draft management.

  5. Dashboard and polish — Live stats, pipeline analytics, settings page with brand voice editor, bulk operations, CSV export, Resend webhook.

Each phase ended with a clean build. No accumulated tech debt. No "we'll fix it later" shortcuts.

The bugs were real but small. TypeScript inferred a mapped array as a union of literal types instead of number[]. Cheerio's $.root() returns Cheerio<Document> which lacks .text(). A regex used the s flag that requires ES2018+. Each got caught by the build and fixed immediately.

The Migration

The 25 existing leads from hodgen-ops needed to come along. I wrote a migration script that reads leads.json, creates a workspace in Supabase, and inserts each lead with its audit data, scores, and notes. Stage names mapped between the two systems (hodgen-ops used "drafted" where Flowline uses "outreach_ready").

The migration ran in about 3 seconds. All 25 leads with full audit histories, score breakdowns, and notes — preserved.

The Numbers

Here's what the final product looks like by the numbers:

  • 49 files created or modified
  • 5,787 lines of TypeScript
  • 21 API routes (CRUD, import, audit, compose, send, bulk, export, settings, webhooks)
  • 7 database tables with row-level security
  • 8 pages (dashboard, leads, lead detail, pipeline, compose, settings, login, signup)
  • 25 leads migrated with full audit histories
  • 0 external UI libraries — all components built with Tailwind CSS

The app is live on Vercel, connected to Supabase, with Resend for delivery and Claude for composition. End-to-end: import a store URL, audit it, score it, compose a 3-email sequence, preview, edit, send — all from the browser.

Why This Matters for Your Business

I'm not writing this to show off. I'm writing it because the economics of building software have fundamentally changed.

Data visualization comparing traditional SaaS MVP development at 4 to 6 weeks and 30 to 50 thousand dollars with a team of 2 to 4 developers versus AI-powered development completed in one session by one person with Claude Code producing 5787 lines across 49 files — highlighting that AI replaces the typing not the thinking Build Economics: Traditional vs AI-Powered Development

Two years ago, building a SaaS MVP like Flowline would have taken a small team 4-6 weeks. Design, backend, frontend, auth, database schema, deployment. You'd be looking at $30-50K in development costs, minimum.

I built it in one session. The AI handled the repetitive work — scaffolding, boilerplate, porting patterns between languages. I handled the architecture, the business logic decisions, and the quality checks.

This is what I mean when I talk about AI as a force multiplier. It doesn't replace the thinking. It replaces the typing. The strategic decisions — what to build, how to score leads, what makes a good outreach email — those are still human. The execution just happens faster.

If you're running a business and wondering what AI can actually do for your operations, this is a concrete example. Not a hypothetical. Not a demo. A production tool that's running right now.

What's Next

Flowline is functional but early. The roadmap includes automated sequences (cron-triggered follow-ups), Stripe billing for multi-tenant SaaS, drag-and-drop kanban, and connectors for WooCommerce and BigCommerce.

But the core loop works: find stores, audit them, score them, write emails, send them, track results. That's the engine. Everything else is polish.

If you're interested in what AI-powered tools could look like for your business — whether it's a CRM, an internal dashboard, or an automation pipeline — book a call. I'll show you what's possible.

Get AI insights for business leaders

Practical AI strategy from someone who built the systems — not just studied them. No spam, no fluff.

Ready to automate your growth?

Book a free 30-minute strategy call with Hodgen.AI.

Book a Strategy Call