← All exercises
Exercise 09 / 10

Your Own SaaS

The capstone. Build a product. Ship it. Share it.

Duration4–8 hours (a full day project)
DifficultyAdvanced
PrerequisitesExercises 01–08 — the full journey so far. Node.js 22.12+, a Stripe account, and an Anthropic API key.
Your Own SaaS
Fig. 09Hands-On Guide
Introduction

Overview

Every chapter so far has been an exercise. This one is different. This is the real thing. You are going to build a product — a complete, publicly accessible micro-SaaS application — from scratch, in one chapter.

Something with a URL you can text to a friend: real users, an AI-powered core feature, and subscriptions in Stripe's sandbox — real payments the day you flip the switch. You'll brief the agent with an AGENTS.md, build plan-first, test in CI, and deploy to your own VPS or Railway.

You are about to ask the agent to generate thousands of lines of code. Without a spec, it will make assumptions — and those assumptions will conflict with each other. A spec is not bureaucracy. It is the single source of truth that keeps you and the agent aligned across dozens of prompts and several sessions.

— from the exercise
What you'll build

By the end of this exercise.

  • A written spec (SPEC.md), an AGENTS.md with a CLAUDE.md pointer, and a permission file that keeps the agent away from .env and git push
  • A Next.js + TypeScript app with SQLite via Prisma 7, built plan-first, one section at a time
  • Email-and-password accounts with Better Auth (hashed passwords, protected routes)
  • Stripe subscriptions in the sandbox — Checkout, verified webhooks, and the Customer Portal
  • An AI core feature on the Claude API with structured outputs, input limits, and rate limiting
  • A Vitest suite (with mocked APIs) running in a least-privilege GitHub Actions CI workflow
  • Deployed to your own VPS behind Caddy or to Railway — a live URL anyone can visit
  • A landing page with SEO and social sharing metadata, and a launch checklist worked through
Key concepts

Terms you'll learn.

SaaS
Software as a Service — a web app users access via a browser, often with paid tiers
AGENTS.md
Standing orders for the agent: the stack, the commands, and the rules — loaded every session
Plan mode
The agent reads and proposes, but can't edit until you approve the plan
Authentication
Proving who you are — sign-up, login, sessions, password hashing
Webhook
A signed message Stripe sends your app when a payment event happens — the only proof of payment
Sandbox
Stripe's test environment — test cards, no real money
Rate limiting
Restricting how many times a user can do something (e.g., 3 AI requests per day)
Environment variables
Secrets (API keys, auth secret) stored outside your code — typed by you, never sent to the agent
What's covered

Sections in this exercise.

  1. 01What You'll Build
  2. 02What You'll Need
  3. 03Pick Your Idea
  4. 04Scaffold the Full Stack
  5. 05Add the AI Brain
  6. 06Users, Auth, and Payments
  7. 07Test It
  8. 08Ship It
  9. 09The Landing Page and Launch Checklist
  10. 10Show Your Work
What just happened

You built a complete product — frontend, backend, database, auth, payments, an AI feature, tests, CI, and a landing page — and shipped it to a live URL. The agent wrote the code. You wrote its standing orders, approved every plan, and made every decision.