// CrimsonCow Labs · open source template

cookiecutter-ai-saas

For builders and vibecoders who can already ship a feature, and want the auth, billing and deploy pipeline around it already built.

Read the code on GitHub Zero to deployed checklist

Want help shipping it? Work with CrimsonCow Labs, who wrote it.

pre-release It generates and runs today — read on before you run anything, and know what you're trying.

Generate your project:
pipx install cookiecutter
cookiecutter gh:CrimsonCowLabs/cookiecutter-ai-saas

// the problem

What stalls a side project

You can already build the feature — that part was never the problem. What stalls a side project is everything standing between it and a stranger using it, and it's the same six things every time:

  • Signing in.

    Someone needs an account and a way back into it, without you hand-rolling sessions.

  • Getting paid.

    A checkout, and a portal that doesn't break when someone upgrades or cancels.

  • Background jobs.

    Work too slow for a web request has to run elsewhere and report back.

  • A worker that can call an LLM safely.

    With a provider you chose, a budget on how much it can do, and somewhere to look when it does something odd.

  • TLS.

    A certificate that renews itself instead of a reminder you'll ignore.

  • Shipping it anywhere but your laptop.

    One command, not nineteen remembered in the right order.

This template is those six things, already done, around the feature you're about to build.

// the stack

What's actually running

Concretely, not abstractly — this is the system a generated project brings up:

The full request path, the generated file layout, and the architecture decisions behind it are in the README.

app
A Next.js app your users see: sign-in, a dashboard, and billing settings when Stripe is on.
worker
A Python worker that does the AI part — pulls a job off the queue, calls the model you chose, reports progress as it goes.
database
Postgres for everything that still has to be there tomorrow.
queue
Redis and BullMQ carrying jobs between the app and the worker.
deploy
A Docker Compose stack behind Caddy that two Ansible playbooks put on a fresh VPS — one provisions it, one deploys — TLS included.

// your choices

What you decide, and what it changes

Cookiecutter asks a short set of questions once, at generation time. These change what your app does:

LLM provider
Ollama, OpenAI, Anthropic, or OpenRouter — whichever the worker calls, and the only credentials you have to go get.
Stripe
On, with real checkout and portal wiring. Off, and the checkout, portal, webhook and billing settings page are left out of the generated project.
Auth providers
Google, Microsoft, or both — which sign-in buttons a visitor sees.
Magic link
Passwordless email sign-in via Resend, independent of whichever OAuth providers you picked.
pgvector
On, and Postgres can do vector similarity search — embeddings, semantic search, retrieval. Off, and it's plain Postgres.
Marketing extras
A small JSON-backed blog and a contact form, for a public site around the app.
Analytics
None, or PostHog behind a consent banner: nothing loads until a visitor accepts, and a Global Privacy Control signal counts as a refusal.

The rest is naming and defaults: project name, slug, and description; author name and email; domain; brand color and theme; Python and Node versions; and the local Postgres and Redis ports. Straight answers, not decisions — with one exception. Your author email doubles as the contact address for your TLS certificate, which is the kind of detail that only matters once, covered in the deployment guide.

// quickstart

From install to a running app

Timed on a clean checkout with Docker's images already pulled: well under a minute from the first command to the app answering in a browser. The first time on a given machine, most of that minute is Docker fetching Postgres, Redis, and the base images — budget a few minutes for that once.

  1. Install cookiecutter, once, ever: pipx install cookiecutter
  2. Generate the project: cookiecutter gh:CrimsonCowLabs/cookiecutter-ai-saas
  3. cd into it, copy .env.example to both .env.local and .env.docker.local, set one secret, and point the docker copy's database and Redis URLs at the container hostnames
  4. Install dependencies: npm ci
  5. Build and start everything: docker compose up -d --build
  6. Create and run the database migrations: npm run db:generate && npm run db:migrate
  7. Open localhost:3000 — it's running

Signing in for real needs OAuth credentials from Google or Microsoft's own dashboards, which is an errand, not a command — that part, and everything past this first run, is in the README's post-generation setup.

// checklist

Zero to deployed

Work it top to bottom and there's no prerequisite left to discover the hard way. Checking an item off is remembered if you close the tab and come back, and the whole list copies as Markdown in one action — paste it into an issue tracker, or hand it to an agent.

1. Before you touch code

Accounts and credentials to have ready before you generate anything. Skip whichever don't match the choices you're about to make.

2. Local setup

From a generated project to the full stack answering on your own machine.

3. Going live

Taking a working local stack to a real URL a stranger can reach.

// faq

Questions people ask

What is cookiecutter-ai-saas?

cookiecutter-ai-saas is an open-source cookiecutter template that generates a full-stack AI SaaS application: a Next.js 16 app in TypeScript, a Python worker that runs a bounded LangGraph agent, Postgres, Redis and BullMQ for background jobs, sign-in through NextAuth, optional Stripe billing, and a Docker Compose stack behind Caddy that Ansible provisions and deploys to a VPS. It is maintained by CrimsonCow Labs and is pre-release: it generates and runs today, but is not yet recommended for production use.

Who is cookiecutter-ai-saas for?

cookiecutter-ai-saas is for developers who can already build the AI feature they want to ship, and would rather not hand-build the sign-in, billing, background jobs, TLS and deployment around it. It fits a side project or an early product that will run on a VPS you control. While it is pre-release, it is best suited to early adopters who are comfortable reading the generated code.

What does cookiecutter-ai-saas cost?

cookiecutter-ai-saas is free: the template is open source under the MIT licence. Any running costs come from choices you make yourself — a VPS and a domain name for a production deployment, usage fees from OpenAI, Anthropic or OpenRouter unless you run models locally with Ollama, and Stripe's own fees if you turn billing on.

What do I need before starting with cookiecutter-ai-saas?

To generate a project with cookiecutter-ai-saas you need Python and pipx, to install cookiecutter. To run it locally you need Node.js (version 20 or newer by default; the generated setup.sh checks for whichever version you chose) and Docker with Docker Compose, plus Poetry to run the Python worker on your own machine (Python version 3.14 by default). The features you switch on need their own credentials: Google or Microsoft OAuth credentials, a Resend API key for magic-link sign-in, Stripe keys, and an API key for your LLM provider, or Ollama running locally. A production deployment also needs a Debian-family VPS (Ubuntu LTS) you can reach over SSH, a domain name you can point at it, and Ansible on your own machine.

How is cookiecutter-ai-saas different from starting from scratch?

Starting from scratch, you build sign-in, billing, a job queue, a worker that calls an LLM, TLS and a deployment pipeline before you get to your own feature. A project generated by cookiecutter-ai-saas has those already wired together, leaves out the parts you declined at generation time (such as Stripe billing, or the blog and contact form), and leaves you to write the feature. The trade-off is that you start from its architecture choices — Next.js, a Python worker, Postgres, Redis and BullMQ, Docker Compose and Ansible — which the README documents so you can judge them before generating.

Can I use cookiecutter-ai-saas commercially?

Yes. cookiecutter-ai-saas is released under the MIT licence, which permits commercial use: you can build, run and sell a commercial product on a project generated from it, without paying or asking permission. The licence's one condition is that its copyright and permission notice stays with copies or substantial portions of the template, and it comes with no warranty.

Where can I get help with cookiecutter-ai-saas?

Questions, bug reports and feature requests for cookiecutter-ai-saas go to its GitHub issues, at github.com/CrimsonCowLabs/cookiecutter-ai-saas/issues. Commercial support for cookiecutter-ai-saas is available from CrimsonCow Labs, at crimsoncowlabs.com.

Commercial support for cookiecutter-ai-saas is available from CrimsonCow Labs: crimsoncowlabs.com, or see the engagements below.

// work with us

Help shipping it, from the people who built it

CrimsonCow Labs does software development consulting and teaching, and wrote and maintains this template — every part of the stack above, and the decisions behind it. If you would rather have help getting your product built on it, or your team up to speed with it, these are the ways to work with us.

Not sure which fits? Tell us what you're building and we'll say.

// contact

Tell us what you're building

A few lines on the product, where it is now and what you need help with is plenty. It goes straight to a person at CrimsonCow Labs, who will reply by email.

Prefer email? aaron@crimsoncowlabs.com

Thanks — your message is on its way. We'll reply by email.

Your message wasn't sent. Check the fields below and try again, or email us at aaron@crimsoncowlabs.com.