Back to Blog

How to Build a SaaS with Claude Code & n8n (GSD Framework)

7 min read

To turn an n8n workflow into a functional SaaS product using Claude Code, you cannot rely on a single massive prompt. You must use a structured orchestration layer like the 'Get Sh*t Done' (GSD) framework. This approach breaks your build into distinct phases—frontend, database, logic, and payments—generating fresh context windows for every task to prevent the AI from getting confused.

I’ve tested this by taking a simple food logging automation and turning it into a deployable web app with valid payments in under an hour. Here is exactly how the framework works and how you can use it to stop building toy apps and start shipping products.

What Is the GSD Framework and Why Do You Need It?

Here’s the thing: most people use Claude Code (and LLMs in general) by opening a chat, dumping a massive idea in, and praying for a good output. That works for scripts. It fails for full-stack applications.

The problem is Context Rot.

Claude has a 200,000-token context window. That sounds like a lot, but as you fill that window with code, error logs, and chat history, the model’s reasoning capability degrades. It gets "dumber" the longer you talk to it. Anthropic tries to fix this with auto-compacting, but it’s a band-aid.

The GSD (Get Sh*t Done) repo is a context engineering layer that sits on top of Claude Code. Instead of one long conversation, it breaks your project into phases (Foundation, Database, Logic, Polish). For every single task within those phases, it spins up a sub-agent with a fresh context window.

This means the AI is just as smart on the last line of code as it was on the first. It costs more tokens, but it actually works.

How Do You Plan a SaaS Build with AI?

Before you write a line of code, you need a Product Requirements Document (PRD). If you skip this, Claude will hallucinate features you don't want.

I don't write PRDs manually. I go to standard Claude (the chatbot, not the code tool) and use a specific prompt to generate a technical blueprint. This blueprint defines your tech stack upfront. For this build, we are using:

  • Frontend: Next.js 15 with Tailwind CSS
  • Backend/Auth: Supabase
  • Logic: n8n Workflows
  • Payments: Stripe

Once Claude generates this PRD, save it as a markdown file. This becomes the "Source of Truth" for the coding agent.

How Do You Initialize the Build?

To get started, you need to install the GSD framework. Open your terminal and run:

npx get-shit-done

Then, inside Claude Code, run /gsd new project. It will ask what you want to build. Paste in that PRD you generated.

The tool will generate three critical files:

  1. Project.md: The master plan.
  2. Roadmap.md: The breakdown of phases.
  3. State.md: Where we are right now.

Here is the cadence you will use for the entire build:

  1. Run a specific plan (e.g., gsd plan phase 1).
  2. Let it generate the tasks.
  3. Execute the task command it gives you.
  4. Clear the context (/clear) when told to.
  5. Repeat.

By clearing the context between phases, you eliminate the rot.

How Do You Handle Databases and Authentication?

For Phase 2, we set up the backend. I use Supabase because it handles both the database and authentication (login/signup) and has a generous free tier.

Create a new project in Supabase. Claude Code will need two things to connect:

  1. Project URL (Found in Settings → API)
  2. Anon Public Key (Found in Settings → API)

Create a .env.local file in your project root and paste these in. Claude Code will then generate SQL scripts to set up your tables.

Critical Step: You must run the SQL migrations in the Supabase SQL editor. Claude will give you the code; you just copy/paste and hit run. This creates the user profiles and sets up Row Level Security (RLS)—which ensures User A can't see User B's data.

How Do You Connect n8n Workflows to Localhost?

This is where most people get stuck. We are building a food logger. The web app takes text/voice input, sends it to an n8n webhook, n8n processes it with AI, and sends the data back.

The problem? Your app is running on localhost:3000. n8n is on the internet. They can't talk to each other easily.

You need ngrok. Ngrok creates a secure tunnel from the public internet to your local machine.

  1. Open a new terminal (keep your app running in another).
  2. Run ngrok http 3000 (or 3001 if your port is different).
  3. Copy the forwarding URL (e.g., https://random-text.ngrok-free.app).
  4. Give this URL to Claude Code.

Claude will update your environment variables so that when you test the app locally, it uses the ngrok tunnel to communicate with your n8n workflow.

How Do You Integrate Stripe for Payments?

Phase 6 is payments. We don't want to write payment logic from scratch; we want to offload it to Stripe.

Do not test with your live Stripe account. In your Stripe dashboard, toggle "Test Mode" on. You’ll need to grab your:

  • Publishable Key (pk_test_...)
  • Secret Key (sk_test_...)
  • Product Price ID (Create a product, click the price, copy the ID)

The GSD framework will execute a plan to create a subscription page. It will handle the logic where a "Free" user sees an upgrade button, and a "Pro" user sees their stats.

The Webhook Trap: Stripe needs to tell your database when a payment succeeds. You must set up a webhook in the Stripe Developer Dashboard pointing to your ngrok URL (/api/stripe/webhook). Select events like customer.subscription.created and updated. If you skip this, users will pay you, but their account won't upgrade.

How Do You Polish the UI (No More AI Slop)?

Out of the box, AI-generated UIs often look generic—dark mode, neon green text, very "Matrix." It looks cheap.

In the final phase (Polish), I use a specific move. I take a screenshot of a UI I like (e.g., Stripe's dashboard) and upload it to Claude Code.

I tell it: "Refactor the landing page using the Claude Frontend Design Skill. Make it look like this screenshot—clean, light mode, orange accents."

The Frontend Design Skill (available from the Claude Code skill marketplace) is specialized for modern UI components (Shadcn/UI). It turned my ugly terminal-looking app into something professional in one pass.

deployment: The Final Step

Once the app works locally, you need to ship it. We use Vercel for this because it integrates perfectly with Next.js.

  1. Push to GitHub: Claude Code can initialize the repo and push your code for you.
  2. Import to Vercel: Go to Vercel, import the new GitHub repo.
  3. Environment Variables: You must copy your .env.local variables (Supabase keys, Stripe keys) into the Vercel settings.

Once deployed, you have a live URL. You can share it, use it, and charge for it.

FAQ

What is context rot in Claude Code?

Context rot occurs as an LLM conversation gets longer; the model's ability to reason and remember early instructions degrades efficiently. The GSD framework solves this by creating fresh "sub-agents" for every task, ensuring the model always operates at peak intelligence.

Is Supabase free for SaaS MVPs?

Yes. Supabase offers a very generous free tier that includes database hosting, authentication, and edge functions. You can build and launch a functional SaaS MVP without paying for the backend infrastructure initially.

How do I fix the 'localhost' connection refused error with n8n?

Localhost is not accessible to the public internet where n8n lives. You must use a tunneling service like ngrok to expose your local port (usually 3000 or 3001) to the web so n8n can send data back to your application.

Can I use this framework with other LLMs?

The GSD framework is specifically optimized for Claude Code. While the principles of phased development apply everywhere, the specific repo and commands are designed for the Anthropic ecosystem.

The Bottom Line

Building software with AI isn't about writing code anymore; it's about orchestration. If you just chat with a bot, you get a script. If you use a framework like GSD to manage context, databases, and deployment, you get a product.

We covered 7,600 lines of code in this build. That is impossible to manage manually in a single chat window. Use the framework, respect the process, and you can go from idea to deployed SaaS in an afternoon.

If you want to go deeper into builds like this, join the free Chase AI community for templates, prompts, and live breakdowns.