DEV Community

Suifeng023
Suifeng023

Posted on

How I Use Claude to Build Full-Stack Apps in Under 4 Hours — The Complete Workflow

How I Use Claude to Build Full-Stack Apps in Under 4 Hours — The Complete Workflow

Three months ago, I spent 3 weeks building a SaaS dashboard. Last week, I built a more complex one in 3 hours and 42 minutes — using Claude as my co-pilot.

The difference wasn't just "using AI." It was a specific, repeatable workflow that eliminates the bottlenecks most developers hit when coding with AI.

Here's exactly how I do it — step by step, with real prompts.

The Problem: Most People Use AI Wrong

I see developers making the same mistakes:

  • ❌ Pasting entire codebases into Claude and hoping for the best
  • ❌ Using vague prompts like "build me a dashboard"
  • ❌ Not breaking down the problem before asking AI
  • ❌ Copy-pasting AI output without understanding it
  • ❌ Not using AI for the things it's actually best at

The secret? AI is a junior developer that never sleeps, never gets bored, and has read every Stack Overflow answer ever written. But like any junior dev, it needs clear direction.

My 4-Hour Framework

I divide every project into 4 phases of ~1 hour each:

Phase Time What AI Does What I Do
1. Blueprint 60 min Generates architecture, tech choices Define requirements, review plan
2. Scaffold 60 min Generates boilerplate, database schema Set up repos, configure env
3. Build 60 min Writes core feature code Review, test, iterate
4. Polish 45 min CSS, error handling, edge cases Final review, deploy

Let me walk through each phase.


Phase 1: Blueprint (60 Minutes)

Before writing a single line of code, I spend an hour planning with Claude. This is the most important phase and the one most people skip.

Step 1: Define the Problem

I start with a clear, structured prompt:

I'm building a SaaS product. Here's what I need:

Product: A subscription analytics dashboard
Users: SaaS founders who want to track MRR, churn, and LTV
Data Source: Stripe API
Tech Stack: Next.js 14 (App Router), TypeScript, Prisma, PostgreSQL, TailwindCSS
Timeline: Need a working prototype today

Give me:
1. A complete database schema with all relationships
2. API route structure (REST endpoints)
3. Component hierarchy (what pages/components I need)
4. The order I should build things in (dependency graph)
5. Potential gotchas I might hit
Enter fullscreen mode Exit fullscreen mode

Why this works: Claude generates a concrete plan. No more "I'll figure it out as I go." You get a roadmap.

Step 2: Generate the Database Schema

Then I drill into each part:

Based on the schema you generated, write:
1. Complete Prisma schema with all models, relations, and indexes
2. Seed data (at least 20 records per model) that looks realistic
3. Migration SQL if needed

Format as a single `schema.prisma` file I can copy directly.
Enter fullscreen mode Exit fullscreen mode

Step 3: API Contract

For each API route, give me:
1. The endpoint path and HTTP method
2. Request body/params type (TypeScript interface)
3. Response type (TypeScript interface)
4. Authentication requirement
5. Brief description of what it does

Format as a TypeScript file with all types exported.
Enter fullscreen mode Exit fullscreen mode

Phase 1 output: You now have a complete spec — database schema, API types, component list, and build order. This would take 2-3 days to produce manually.


Phase 2: Scaffold (60 Minutes)

Now let AI generate all the boring stuff.

Generate Project Structure

Set up a Next.js 14 project with:
- App Router (not Pages Router)
- TypeScript strict mode
- TailwindCSS with these custom colors: [your palette]
- Prisma with PostgreSQL
- NextAuth.js for authentication (GitHub + email)
- shadcn/ui component library

Give me the exact commands to run and the folder structure.
Enter fullscreen mode Exit fullscreen mode

Generate Type Definitions

Create a complete `types/index.ts` file that includes:
- All database model types (from our schema)
- All API request/response types
- All component prop types
- Utility types (pagination, API response wrapper, etc.)

Make it fully typed. No `any` allowed.
Enter fullscreen mode Exit fullscreen mode

Generate Utility Functions

Write these utility functions:
1. `apiResponse<T>(data, status, message)`  standardized API response
2. `validateRequest<T>(schema, body)`  Zod validation wrapper
3. `paginate(query, page, limit)`  cursor-based pagination
4. `formatCurrency(amount, currency)`  i18n currency formatting
5. `calculateMRR(subscriptions)`  Monthly Recurring Revenue calc
6. `calculateChurn(subscriptions, period)`  Churn rate calc

Each function should be production-ready with proper error handling.
Enter fullscreen mode Exit fullscreen mode

Phase 2 output: A complete project skeleton with types, utils, auth, and database — ready to build features on top of.


Phase 3: Build (60 Minutes)

This is where the magic happens. I build features one at a time, using a specific prompt pattern.

The Feature Prompt Pattern

For every feature, I use this template:

Build me the [FEATURE NAME] feature.

Context:
- Tech stack: Next.js 14, TypeScript, Prisma, TailwindCSS, shadcn/ui
- Database schema: [paste relevant models]
- API types: [paste relevant types]

Requirements:
1. [Specific requirement 1]
2. [Specific requirement 2]
3. [Specific requirement 3]

Give me:
1. The API route code (app/api/...)
2. The React component code
3. Any Prisma queries needed
4. Test cases for edge cases

Important rules:
- Use Server Components by default, Client Components only when needed
- Handle loading states and errors
- Use optimistic updates where appropriate
Enter fullscreen mode Exit fullscreen mode

Example: Building the Dashboard Page

Build me the main dashboard page.

It should show:
1. Revenue chart (line chart, last 12 months)  use Recharts
2. Current MRR card with % change from last month
3. Active subscribers count
4. Churn rate card
5. Top 5 plans by revenue (horizontal bar chart)
6. Recent transactions table (last 10, with pagination)

Layout:
- Top row: 3 stat cards
- Middle: Revenue chart spanning full width
- Bottom left: Bar chart
- Bottom right: Transactions table

Use shadcn/ui Card components. Make it responsive.
Enter fullscreen mode Exit fullscreen mode

Key Insight: Build Bottom-Up

I always build in this order:

  1. Database queries first (verify data layer works)
  2. API routes second (test with curl/Postman)
  3. Components third (connect to real API)
  4. Page composition last (assemble components)

This way, when something breaks, you know exactly which layer to debug.


Phase 4: Polish (45 Minutes)

The last phase is all about going from "it works" to "it's production-ready."

Error Handling Pass

Review all the code we've written. For each file, add:
1. Proper error boundaries (React)
2. Try-catch blocks with meaningful error messages
3. Input validation (use Zod schemas)
4. Loading skeletons for every async component
5. Empty states for lists and tables

Format as a diff or complete file replacement.
Enter fullscreen mode Exit fullscreen mode

CSS Polish

Polish the UI. Make these improvements:
1. Add subtle animations on page transitions (framer-motion)
2. Hover effects on all interactive elements
3. Proper focus styles for accessibility
4. Dark mode support (use TailwindCSS dark: prefix)
5. Mobile-responsive adjustments (test at 375px, 768px, 1440px)

Show me the updated TailwindCSS classes and any new CSS needed.
Enter fullscreen mode Exit fullscreen mode

Edge Cases

What edge cases should I handle for this app? Think about:
1. Empty states (no data, no users, no subscriptions)
2. Error states (API down, network error, 401/403/500)
3. Loading states (first load, pagination, mutations)
4. Boundary values (0 MRR, 100% churn, negative growth)
5. Concurrent operations (two tabs, race conditions)

For each edge case, give me the component code to handle it.
Enter fullscreen mode Exit fullscreen mode

Phase 4 output: A polished, production-ready app with proper error handling, animations, and edge case coverage.


The Results Speak for Themselves

Here's my actual time tracking from the last project:

Task Manual Time With Claude Savings
Database schema 3 hours 15 minutes 92%
API routes 8 hours 90 minutes 81%
UI components 12 hours 2 hours 83%
Error handling 4 hours 30 minutes 88%
Testing 6 hours 45 minutes 88%
Total 33 hours 3h 42min 89%

5 Tips That Made the Biggest Difference

1. Always Plan Before Coding

The 60-minute blueprint phase saves 10x its time later. Claude is incredible at architecture — use that.

2. Give Claude Context, Not Just Instructions

Instead of "build a login page," say: "Build a login page using NextAuth.js with GitHub provider. The database uses Prisma with a User model that has id, email, name, image, createdAt. After login, redirect to /dashboard. Show errors inline, not alerts."

3. Iterate in Small Chunks

Don't ask for the whole app at once. Ask for one feature, test it, then move on. Small feedback loops catch errors early.

4. Use Claude for Code Review Too

After building each feature, I ask Claude to review its own code:

Review the code you just wrote for:
1. Security vulnerabilities
2. Performance issues
3. Accessibility problems
4. TypeScript type safety
5. Best practices violations

Rate each issue by severity (critical/warning/info).
Enter fullscreen mode Exit fullscreen mode

5. Keep a Prompt Library

I save every prompt that works well. After 3 months, I have 50+ reusable prompt templates that I can customize for any project.

The Tools I Use

  • Claude — Primary AI coding assistant (best at understanding large codebases)
  • Next.js 14 — App Router is incredible for AI-assisted development
  • Prisma — Type-safe database access (AI generates perfect schemas)
  • shadcn/ui — Beautiful components that are easy for AI to customize
  • Vercel — One-command deploy (AI handles the CI/CD config)
  • Raycast — Quick Claude access from anywhere

What This Framework Is NOT

  • 🚫 It's NOT about replacing developers
  • 🚫 It's NOT about generating code blindly
  • 🚫 It's NOT a shortcut to skip learning
  • ✅ It IS about amplifying what you can build
  • ✅ It IS about eliminating repetitive work
  • ✅ It IS about shipping faster without cutting corners

Final Thoughts

The developers who will thrive in 2024 and beyond aren't the ones who avoid AI — they're the ones who learn to direct it effectively.

Think of yourself as a tech lead and Claude as your junior developer team. Your job is to:

  1. Define the architecture
  2. Write clear requirements
  3. Review and approve code
  4. Make the final decisions

If you can do those four things, you can build full-stack apps in under 4 hours.

What's your experience building with AI? I'd love to hear your workflow in the comments. 👇


If you found this useful, follow me for more AI-assisted development tutorials. I post weekly about building faster with Claude.

Top comments (0)