SaaS tech stack: what to build on when AI writes the code

The parts every SaaS needs, the stacks that are sensible defaults today, what each costs to run, and how a coding agent changes the choice.

Last updated

Abstract illustration of stacked translucent layers forming a single block, each layer a different part of an app

There is no single best tech stack for SaaS; there is the stack you (and your coding agent) can ship and maintain. Every SaaS needs the same ten or so parts: a language and framework, a database, login, payments, background jobs, email, file storage, hosting with deploys, error monitoring, and maybe mobile apps. In late 2026 three combinations are sensible defaults:

  • Next.js with a hosted Postgres database and an auth service, if you already think in TypeScript.
  • A batteries-included framework (Ruby on Rails, Laravel or Django) with PostgreSQL on one server, if you want most of those parts in one codebase.
  • A prompt-to-app builder like Lovable, if you are not a developer and want to test an idea first.

The rest of this page explains each part in plain words, describes each stack fairly from its own docs, shows what each costs at small scale (prices fetched from the vendors on November 30, 2026), and covers what changes when an AI agent writes most of the code.

A disclosure, once: this site sells RailsFast, a Rails template. Rails is a good fit for a lot of founders, and it is not the right answer for everyone. Where another stack is the better choice for you, this page says so.

The parts every SaaS needs

A "tech stack" is just the list of tools your product is built and run on. Whatever you pick, you need something for each of these layers. A framework that includes a layer saves you a vendor, a bill and an integration your agent has to get right.

Layer What it does, in plain words What goes wrong without it
Language and framework The code your app is written in, plus the structure that organizes it (Rails, Next.js, Laravel, Django) Every feature is invented from scratch, and every project looks different to the agent
Database Where users, orders and everything else are stored permanently (usually PostgreSQL) Data disappears on restart or lives in places you cannot back up or query
Login (auth) Sign up, log in, password reset, sessions, and checking who may see what Strangers get in, or one user can read another user's data
Payments Taking money and managing subscriptions (usually Stripe), plus webhooks that tell your app a payment happened People pay and get nothing, or get the product without paying
Background jobs Work that runs outside a page load: sending email, processing uploads, retrying a failed webhook Pages hang for seconds, and failed work is silently lost
Email Transactional mail: confirmations, password resets, receipts Users cannot reset passwords or confirm accounts; mail lands in spam
File storage Uploads such as avatars and documents, stored in S3 or a compatible service Files vanish on the next deploy or fill the server disk
Hosting and deploys The servers your app runs on and the command that puts new code live Deploys are scary, manual and impossible to roll back
Monitoring Error tracking and uptime checks (Sentry and similar) You learn about bugs from angry customers, if at all
Mobile apps (optional) iOS and Android apps, native or wrapping your web app A second codebase to build and keep in sync, if you need one at all

Security is not a separate layer: it is mostly login, authorization and secrets handled correctly in the layers above. The website launch checklist covers what to verify before real users arrive.

The common stacks, described fairly

Each of these can run a real business. The differences are in how many of the layers above come built in, how many services you wire together, and what you already know.

Next.js with a hosted database and auth service

What it is. Next.js is a React framework for full-stack web apps, written in TypeScript or JavaScript. The typical SaaS setup pairs it with a hosted Postgres database (Supabase or Neon), an auth service or library, Stripe, and hosting on Vercel.

What it is good at. Interactive, app-like interfaces; one language (TypeScript) across front end and back end; a large pool of React developers, components and examples. It also ships its own tooling for coding agents (more on that below).

What you assemble yourself. Next.js does not ship login. Its own authentication guide says "we recommend using an authentication library" and lists twelve, including Auth0, Better Auth, Clerk, NextAuth.js, Supabase and WorkOS. The same is true for background jobs, email and file storage: each is a separate service or library you choose and connect.

What it costs at small scale (as of November 30, 2026):

  • Vercel: Hobby is $0 but "limited to the usage caps and cannot purchase additional usage"; Pro is $20 a month per developer seat with a $20 usage credit included.
  • Supabase: Free has a 500 MB database and 50,000 monthly active users, and "Free projects are paused after 1 week of inactivity." Pro starts at $25 a month with 8 GB of disk, 100,000 monthly active users and $10 of compute credits.
  • Clerk (if you use it for login): free up to 50,000 monthly retained users per app; Pro is $25 a month billed monthly ($20 billed annually), then $0.02 per extra retained user.

One developer on Vercel Pro ($20) and Supabase Pro ($25) comes to about $45 a month before email, monitoring and usage overages.

Real trade-offs. More vendors means more dashboards, more API keys, more bills and more integration code. Next.js itself says agents "may rely on training data that predates the Next.js version installed in a project," which is why it now ships version-matched docs for them. If your team already knows TypeScript and React, this is usually your best choice: the stack you know beats the stack someone says is better.

Ruby on Rails with PostgreSQL

What it is. Rails is a full-stack Ruby framework (current release 8.1.4.1, November 4, 2026). It is "batteries included": most layers in the table above ship in the box.

What comes built in. Active Record for the database; an authentication generator that "creates a starting point for a session-based, password-resettable, metadata-tracking authentication system"; Solid Queue for background jobs, which "replaces the need for Redis, also a separate job-running framework"; Action Mailer for email; Active Storage for uploads to S3 and similar services; Kamal 2 for deploys, preconfigured in new apps; and Hotwire for the front end, with Hotwire Native to wrap the web app in iOS and Android shells. Payments (Stripe) and error monitoring are still separate.

What it is good at. Standard B2B SaaS: accounts, dashboards, forms, billing, admin. One codebase, one database, one server for a long time. Strong conventions, so Rails projects look alike, which helps both new developers and agents. The notes for the On Rails podcast episode with DHH say the backend is so stable that a model file written today looks at home next to one from 2013.

What it costs at small scale. Kamal deploys to any server, "from bare metal to cloud VMs." A DigitalOcean Basic Droplet with 1 GiB of RAM is $6 a month and 2 GiB is $12 (as of November 30, 2026); with Solid Queue and Postgres on the same machine, one $12 server is, in our view, a reasonable place to start. Add email and backups.

Real trade-offs. Ruby may mean a smaller hiring pool than TypeScript or Python. Hotwire is a different way to build interfaces than React, so a team that lives in React will feel friction (you can still use React inside Rails). And running your own server means you own updates and backups, even if Kamal makes deploys one command. The full argument for Rails, including why it suits agents, is on why Rails. If you want those built-in parts already wired with Stripe, email and deploys, RailsFast is a Rails codebase set up that way, with conventions and an AGENTS.md for coding agents.

Laravel

What it is. Laravel is a full-stack PHP framework (docs are at version 13.x), as batteries-included as Rails.

What comes built in. Official starter kits for React, Vue, Svelte (through Inertia) and Livewire that include the routes, controllers and views to register and authenticate users, with two-factor authentication on by default and optional team support. Laravel also has first-party packages for billing (Cashier), queues, websockets and more, and a WorkOS-powered starter kit variant for social login, passkeys and SSO.

What it is good at. PHP teams, and anyone who wants a React or Vue front end with a conventional backend behind it. Laravel's own ecosystem covers a lot from a single vendor, including hosting.

What it costs at small scale. Laravel Cloud Starter is $5 a month plus usage, with $5 of monthly usage credit and a free first month; Growth is $20 a month plus usage. Compute "scales to zero" when idle; a Flex 1 GiB instance is capped at $12 a month. Laravel's own pricing page estimates a "SaaS MVP app" scenario at about $45.71 a month (as of November 30, 2026). You can also self-host on a VPS with Forge.

Real trade-offs. PHP has a reputation problem with some developers that does not match modern Laravel, but it can affect hiring. Usage-based hosting is cheap when idle and less predictable when busy; spending limits help. If you already write PHP, Laravel is the obvious pick.

Django

What it is. "The web framework for perfectionists with deadlines": a full-stack Python framework (latest release 6.1.3).

What comes built in. An ORM, an "automatic admin interface," and an auth system with users, permissions, groups and password hashing. Django's docs say some common pieces "have been implemented in third-party packages," including login throttling and OAuth. Django 6.0 added a Tasks framework for background work, but it "does not provide a worker mechanism to run tasks," so you still add a worker for production.

What it is good at. Python teams, data-heavy products, and SaaS that sits next to machine learning or analytics code. The admin is a real head start for internal tools.

What it costs at small scale. Like Rails, it can run on one small VPS ($6 to $12 a month on DigitalOcean as of November 30, 2026) with Postgres, plus a worker process.

Real trade-offs. More assembly than Rails or Laravel for SaaS basics like social login, billing and job workers. If your team writes Python, or your product is mostly data and models, Django is the honest best choice.

A prompt-to-app builder's default stack

What it is. Tools like Lovable, Bolt, Replit, Base44 and v0 generate a working app from a chat. Lovable's docs say new apps "use TanStack Start, which renders pages on the server" (since May 13, 2026), older apps use React and Vite, and the database is "a PostgreSQL database through the built-in backend" or your own Supabase project.

What it is good at. Getting a clickable product in front of users in an afternoon without writing code. You can keep a GitHub repository in sync on any plan.

What it costs. Lovable Pro starts at $25 a month for 100 credits and Business at $50 a month for 100 credits (as of November 30, 2026). Hosting and backend usage are paid from the same credit balance once an app gets real traffic.

Real trade-offs. You inherit whatever the builder generated, and the security of the data layer is easy to get wrong: a scan of 1,072 vibe-coded sites that use Supabase, published June 2, 2026 by Symbiotic Security, found that 98% had at least one security flaw and 16% had a critical one, with a Supabase anon key exposed in the site's JavaScript as the most common high-severity finding. Supabase's own docs warn that a table in an exposed schema without RLS is "readable and writable by any role" with a grant on it. If you are not a developer and are testing whether anyone wants the idea, start here. The best vibe coding tools page compares the builders.

The stacks side by side

Next.js + hosted services Rails + PostgreSQL Laravel Django Prompt-to-app builder
Language TypeScript Ruby PHP Python Generated TypeScript
Login built in No (library or service) Generator Starter kits Yes, basic Builder's backend
Background jobs built in No Yes (Solid Queue) Yes (queues) API only, add a worker Depends on builder
Deploy tool Vercel (or any Node host) Kamal to any server Laravel Cloud or Forge Your choice Builder hosting
Small-scale running cost (Nov 30, 2026) About $45/month on Vercel Pro + Supabase Pro About $6 to $12/month on one VPS From $5/month plus usage About $6 to $12/month on one VPS From $25/month (Lovable Pro)
Best for TypeScript and React teams Solo founders and small teams building standard SaaS PHP teams Python and data teams Non-developers validating an idea

Whatever you pick, Stripe takes the same cut: 2.9% + $0.30 per successful US domestic card charge, plus 1.5% for international cards, 1% if currency conversion is needed, and 0.7% of volume for Stripe Billing subscriptions (as of November 30, 2026). The Stripe fee calculator shows what that means at your price.

Email and error monitoring cost about the same on every stack, and both have free tiers. Resend's free plan sends 3,000 transactional emails a month (capped at 100 a day) and Pro is $20 a month for 50,000. Sentry's free Developer plan covers one user and 5,000 errors, and Team is $29 a month billed monthly ($26 billed annually) (as of November 30, 2026).

What changes when an AI agent writes the code

If Claude Code, Codex or Cursor writes most of your product, the stack question changes from "what do I like writing" to "where does the agent make the fewest mistakes I cannot see." Here is what the sources that exist today actually show.

Agents know old versions best. The Next.js docs put it plainly: agents "may rely on training data that predates the Next.js version installed in a project." Next.js 16.2 and later bundle version-matched docs in node_modules/next/dist/docs/, and create-next-app writes an AGENTS.md that tells the agent to read them. In principle, frameworks that change slowly should suffer less from this, and frameworks that change fast are starting to ship fixes for it.

Project instructions measurably help. Vercel's evals (January 27, 2026) found an AGENTS.md docs index reached a 100% pass rate on its Next.js tasks, against 53% with no docs and 79% at best for a Skill. On the current Next.js eval board (last run October 30, 2026), the top models score 100% even without it, and more models reach 100% with it. AGENTS.md is now "used by over 60k open-source projects" and is stewarded by the Agentic AI Foundation under the Linux Foundation. Whatever stack you choose, give the agent a CLAUDE.md or AGENTS.md.

Rails has a foundation-run benchmark. The Rails Foundation's "Agents on Rails" report (August 13, 2026) ran 8 models against 21 Rails tasks, 3 runs each; the most accurate model solved 92% of runs. Giving the agent more Rails documentation changed its style more than its success rate: "Context clearly steers style, but can it fix reasoning?" The official Rails site argues "Rails gives agents a map" and "Less code means more context."

Laravel ships agent tooling too. Laravel Boost is an MCP server (a way for agents to call tools in your app) with 15 tools for the database schema, routes, logs and version-aware docs search:

composer require laravel/boost --dev
php artisan boost:install

We found no fair cross-framework comparison. The Next.js and Rails numbers use different tasks and harnesses, so you cannot say one framework is "better for AI" from them. Be suspicious of any page that does.

What the evidence does support, across stacks:

  • Fewer moving parts means fewer integration bugs. Every extra service is another SDK, another set of keys and another webhook the agent has to wire correctly. Batteries-included frameworks remove some of that; a good template removes more.
  • Conventions help the agent guess right. When every project puts things in the same place, the agent's training data matches your codebase.
  • Tests are how you check work you did not write. Pick a stack where the agent can run the test suite itself, and make "run the tests" part of every task. How to use Claude Code covers that loop, and Codex vs Claude Code compares the two main agents.
  • Authorization must live on the server. The vibe-coding security scan above found many sites with data exposed because access rules were missing. Whatever your stack, check that one user cannot read another user's data.

So what is the best language for vibe coding?

The language matters less than the framework around it. TypeScript, Ruby, Python and PHP all have years of public code that models learned from. Choose the one whose framework includes the most SaaS parts you need, and whose code you can at least read when you review what the agent did.

How to choose

You are You are building Sensible default
A team that already knows TypeScript and React A UI-heavy app (editors, real-time collaboration, rich dashboards) Next.js + Supabase or Neon + an auth library + Vercel
A solo founder or small team, no strong language preference A standard B2B SaaS (accounts, billing, CRUD, admin) Rails + PostgreSQL on one server with Kamal, or Laravel
A PHP developer Anything web Laravel with a starter kit, on Laravel Cloud or Forge
A Python or data team A product built around data, analytics or models Django + PostgreSQL + a job worker
Not a developer A first version to see if anyone wants it A prompt-to-app builder, synced to GitHub from day one
Mobile-first A consumer app where the phone is the product Expo (React Native) with a backend from the rows above
Web-first, mobile later A web SaaS that will need app-store apps Rails with Hotwire Native, or any web stack plus a wrapper

Two tie-breakers when the table does not settle it. First, pick what you can debug at 2 a.m. when the agent is stuck. Second, pick the stack with fewer separate services, because each one is a bill and a failure point.

What not to spend time on before you have users

  • Microservices. One app, one database. Split later if a real bottleneck appears.
  • Kubernetes. Even an author who ran it in production for his own SaaS writes, "I wouldn't recommend it if you're getting started."
  • Multi-region and "infinite scale." A new product rarely has more traffic than one small server can handle.
  • Choosing between five auth vendors or three ORMs. Pick the framework default and move on.
  • A custom design system. Use the component library your framework or template ships.
  • Rewriting in a "faster" stack. Speed of shipping beats speed of execution until you have customers.
  • Benchmarks. Agent and framework benchmarks are useful signals, not a reason to switch stacks mid-build.

Spend the time instead on what customers touch: login that works, payments that cannot be faked, password reset email that arrives, and backups you have restored at least once.

Frequently asked questions

What is the best tech stack for SaaS?

There is no single best tech stack for SaaS. The best one is the stack your team already knows that covers the parts every SaaS needs: database, login, payments, background jobs, email, storage, deploys and monitoring. For most new products in 2026 that means Next.js with hosted services for TypeScript teams, or a batteries-included framework like Rails, Laravel or Django with PostgreSQL.

What is the best stack for vibe coding?

The best stack for vibe coding is one with strong conventions, few separate services and a test suite the agent can run. A prompt-to-app builder is the fastest start for non-developers; a batteries-included framework or a well-structured template is easier for an agent to extend safely once the product is real. Add an AGENTS.md or CLAUDE.md so the agent knows your project's rules.

What is the best language for vibe coding?

The framework matters more than the language. TypeScript, Ruby, Python and PHP all work well with current coding agents because there is a lot of public code in each. Pick the language whose framework gives you the most SaaS features built in and that you can read when you review the agent's work.

What is the best framework for AI coding?

We found no published benchmark that compares frameworks fairly on the same tasks. Next.js publishes agent evals and ships version-matched docs for agents, Rails has a foundation-run agent benchmark and strong conventions, and Laravel ships an MCP server called Boost. Choose on team skills and built-in features, then give the agent good project instructions.

What is a SaaS starter kit?

A SaaS starter kit (or boilerplate) is a codebase with the common SaaS parts already built: login, billing, email, an admin area and deploy setup. You start from it and add your own product on top. Choose one in a stack you know, judge it on code quality, documentation and update history rather than feature lists, and check whether it ships instructions for coding agents.

How much does it cost to run a SaaS stack at small scale?

As of November 30, 2026, a Rails, Django or Laravel app can run on a single $6 to $12 a month VPS, and Laravel Cloud starts at $5 a month plus usage. A Next.js app on Vercel Pro ($20 a month per developer) with Supabase Pro (from $25 a month) starts around $45. Payment fees come on top: Stripe charges 2.9% + $0.30 per US domestic card payment.

Is Next.js or Rails better for a SaaS?

Neither is better in general. Next.js suits teams who know React and want app-like interfaces, and it relies on separate services for login, jobs and email. Rails includes those parts in one codebase and runs cheaply on one server, which suits solo founders and standard B2B SaaS. See why Rails for the full case for Rails.

Sources

All pages fetched on November 30, 2026.

Checklist

Grab your free launch checklist 🚀

The definitive checklist to launch any project. It includes pre-launch steps & a detailed launch checklist you can go through to get your new project off the ground.

Secure connection. No spam.