Build a SaaS on Lovable: The Foundation Prompt, the Schema That Proves Its Policies, and the Billing Step
A SaaS is a multi-tenant app plus the machinery that lets strangers pay for it without reading each other's data. This page is the order that machinery gets built on Lovable, taken from the kit this site ships: the foundation prompt, which was run for a measured number of credits; the schema, whose tables, policies and verification checks are counted from the file at build time; the mechanics prompts that make the app chargeable; and billing, last, with the rule that keeps it honest. The Cadence build from earlier today is the worked example, and what it still lacks is listed.
Updated

What order avoids rework?
The one where each step is proven before the next depends on it. Accounts before roles, roles before any screen that hides by role, the schema before the features that write to it, a landing page before billing, and billing wired so the webhook is the only thing that grants access.
- Foundation: prompt, 10.4 cr
- Schema: kit migration
- Verify: as a member
- Landing page: count sign-ups
- Mechanics: limits, trial
- Billing: webhook writes
The SaaS starter kit's setup steps and the SaaS prompts' build orders, condensed.
Step one: the foundation prompt, and what it cost
The prompt is SaaS MVP with User Auth from the SaaS prompts: email and password auth that survives refresh, a workspace on first sign-in, three roles, invite by tokenised link, role-gated UI, and the safeguard that roles are enforced in the database. Run on 2026-09-26 for 10.4 credits: it asked 4 questions, enabled Cloud, self-tested sign-up and invites, roles checked in the database.

The prompt examples page has the four questions it asked first and the rest of the screenshots.
Step two: the schema, counted from the file
The SaaS starter kit ships the database the foundation prompt expects. The numbers below are read from its files when this page is built, so they cannot drift from what you download.
| Category | count |
|---|---|
| Tables | 4 |
| RLS policies | 12 |
| Helper functions | 4 |
| Verification statements | 6 |
src/data/templates.ts, read 26 September 2026. Tables: profiles, workspaces, workspace_members, workspace_invites.
| Detail | |
|---|---|
| Run schema.sql in the Supabase SQL editor | Before prompting Lovable. The prompt references these table names, so building first means rework. |
| Run verify.sql as an ordinary signed-in user | Not as service_role, which bypasses every policy and will make a broken schema look correct. |
| Paste prompt.md into Lovable | Unedited on the first pass, so you can see what the structure produces before changing it. |
| Replace the audience line | The Context section names a small team adopting a tool. Changing that one line changes which features Lovable prioritises more than anything else in the prompt. |
The traps the kit was written around: a recursive policy on the membership table, and a member promoting themselves to owner through an update policy without a with-check clause. The Lovable and Supabase guide has the three shapes of that failure.
Step three: prove the policies deny
Lovable's Quick and Deep scans confirm that row-level security is present on a table. Neither runs a query as the wrong user, which is the only proof a policy denies. The kit's verify.sql does: sign in as an ordinary member, read another workspace's rows, promote yourself to owner, and expect both to fail. On the Cadence build the Deep scan reported nothing at any severity and the dependency panel listed two known issues; the security page has the run and the distinction.
-- Verification queries. Run these as an ordinary signed-in user, not as service_role.
-- Every one of them must behave as described or a policy is wrong.
-- 1. Should return only workspaces you are a member of, never every workspace.
select id, name, plan from public.workspaces;
-- 2. Should return zero rows for a workspace you do not belong to.
-- Substitute a workspace id you are NOT a member of.
select * from public.workspace_members
where workspace_id = '00000000-0000-0000-0000-000000000000';
-- 3. Should FAIL for a member (non-admin). If it succeeds, the write policy is too loose.
insert into public.workspace_members (workspace_id, user_id, role)
values ('<a workspace where you are role=member>', auth.uid(), 'owner');
...Step four: the landing page, before billing
A SaaS with no sign-ups does not need a checkout. The six-section SaaS landing page prompt was run on 26 September 2026 for 4.5 credits in a separate project so its analytics stay clean; it counts sign-ups against visitors from one channel, which decides whether steps five and six are worth building.
| Category | credits |
|---|---|
| Foundation | 10.4 (12:26) |
| SEO review | 1.1 (14:29) |
| Security | 1.3 (18:06) |
| Installable | 3.1 (18:36) |
| Landing page | 4.5 (19:19) |
Composed from the run files in src/data/mvpLedger.ts, 26 September 2026.
Steps five and six: the mechanics, then billing
The SaaS category holds 15 mechanics prompts. The five that turn a working app into a chargeable one, in the order their build sections assume:
| What it adds | |
|---|---|
| Subscription Checkout Flow | A Stripe subscription flow whose states all exist: checkout, success, failure, cancel, and the webhook that keeps the app honest. |
| Payment History & Billing Pages | Customer-facing billing: invoice history, payment method management, and plan changes, driven by Stripe as the source of truth. |
| SaaS Teams & Permissions Manager | Team management for an existing multi-tenant app: role changes, removals, and transfers that hold up in the database, not just the UI. |
| SaaS Usage Limits & Quotas Manager | Plan-tier limits that are enforced where they must be and visible where they help: server-side gates with honest usage meters in the UI. |
| SaaS Trial Expiration Flow | A trial that actually ends: countdown, honest lockout, data retention, and the reactivation path, driven by dates on the server. |
Billing itself is the Lovable and Stripe page: built-in payments on a paid plan or your own key on Free, Stripe's rule that the success page is not proof of payment, and this site's own webhook with its two idempotency layers. The rule that survives every path: the webhook is the only writer of entitlement, and the member page only reads.
What do the top results for this term leave out?
- Base44, How to build a SaaS product. About 2,400 words, 10 May 2026, eight steps, three third-party statistics, no build shown; the CTA is the builder.
- Syndicode, How to Build a SaaS Product. About 8,500 words, 2023, eight steps, a hypothetical estimate of $174,000 to $396,000 and 44 to 82 weeks; agency case studies; the CTA is the agency.
- A Medium post on building a SaaS in five hours with AI. Blocked to our fetch, so it is listed, not characterised.
What we did not publish
- Steps five and six as runs. The mechanics prompts and the billing step are documented, not executed on Cadence; the page says which steps carry a credit figure and which do not.
- A customer. The build has no users and no revenue; the landing page exists to find out whether it should.
- A timeline in weeks. The measured day is on the how-to-build-an-MVP page; extrapolating it to a launch would be a guess.
Sources
Kit counts from src/data/templates.ts at build time; runs from src/data/runs.ts and src/data/mvpLedger.ts; read 26 September 2026.
Frequently asked
How do you build a SaaS with Lovable?↓
What does the SaaS starter kit contain?↓
Why run verification queries as a member and not as admin?↓
How much does it cost to build a SaaS this way?↓
When do you add payments?↓
What is still unbuilt after the foundation?↓
Related reading
- the SaaS starter kit
The schema and checks this page counts.
- Lovable SaaS prompts
The foundation and the mechanics prompts.
- Lovable and Supabase
The three RLS failure shapes.
- Lovable security
What the scans prove, and what only a query does.
- Lovable and Stripe
The billing step, with our own webhook.
- SaaS landing page prompt
Step four, run for 4.5 credits.
- how to build an MVP
The measured day behind the ledger.
- SaaS ideas
Fifteen products composed from the same mechanics.
- three prompts and what they built
The foundation run's screenshots.
- how Lovable credits work
What the credit figures pay for.
- CRM app prompts
A worked product category on top of the foundation.
- admin dashboard prompts
The operator surface on top of the foundation.
Written by

Marco Kohns
Founder of ProtoBites - Venture Growth Studio
Growth PM at a Silicon Valley scale-up (a16z and General Catalyst backed), ex-Techstars where he consulted 13 early-stage startups, Reforge-trained. Every prompt on this site comes out of shipping ProtoBites' own portfolio products.