Run in Lovable 10.4 credits · 4 questions, then one buildPaid workspaceChecked

    Lovable SaaS prompt: auth, roles and an invite flow Lovable tested itself

    Fill in three fields, copy the prompt, paste it into a new Lovable project. Unedited, it asked 4 questions, enabled the backend, built a workspace with three roles and checked its own invite flow as a second user, for 10.4 credits.

    By Marco Kohns · Prompt written and run by us

    Make it yours

    One object. The first screen after sign-up shows it, empty, with the first action.
    How should Lovable decide the look?
    What we ran. Lovable's fourth question offered three visual directions inline, at no extra credit cost.
    Keep these sections
    prompt · saas-mvp-auth · 373 words
    # ContextBuild the foundation of a multi-tenant SaaS: users sign up, get a workspace, and invite teammates who arrive in the same workspace with the right role. The target user is a small team adopting a tool together, so the invite must work before anything is polished. ## Core Features (Priority Order)1. Email and password auth with session persistence across refresh2. Workspace created automatically on first sign-in, creator becomes owner3. Member list with three roles: owner, admin, member4. Invite by email via tokenized link that joins the invitee to the inviter's workspace5. Role-gated UI: only owner and admin can invite or change roles ## Access & Session Rules- Roles are read from the database per request, never from client state- Protected routes redirect signed-out users to sign-in and return them after- Sessions persist across refresh and expire gracefully with a re-auth prompt, not a crash- An expired or already-used invite shows a clear error and a way to request a new one- Email and password first; Lovable's built-in auth also offers Google, Apple, Microsoft, Sign in with Lovable and SAML SSO, so add a provider only after the role model works end to end ## Screens & States- Sign in / sign up with inline validation, no alert() dialogs- Member list: loading skeleton, and an empty state that prompts the first invite- Invite dialog with a copyable link and a sent-state confirmation ## Build OrderAuth and the route guard first. Then the role-checking helper, before any UI that depends on a role. Then workspace and member reads, then the invite write path including the expired-token case. ## Safe-Guard Instructions- Enforce roles in the database with row-level security as well as in the UI; hiding a button is not access control- Never accept a role or workspace id from the client on writes- Do not weaken a security policy to make a query work; if the query is denied, the query is wrong ## Before BuildingAsk me any questions you need in order to fully understand the audience and the offer, then save the decisions to the project knowledge so later prompts build on them.

    Disclosure: if you create a Lovable account through links on this page, we may earn a commission. It costs you nothing and does not change what we recommend.

    Paste it into LovableUnedited, this prompt cost 10.4 credits in one build after 4 questions, in our own workspace.

    Measured run

    What Lovable built from the unedited prompt

    Fresh project in our own workspace, Build mode, prompt pasted as is. 26 September 2026.

    Lovable project chat right after the SaaS MVP prompt was sent, showing a question card that asks what this SaaS is for, who the team using it is and what they will do inside a workspace, with an answer field, Skip all and Next
    The first of 4 questions before any code
    Lovable question card titled Which visual direction fits best, showing three colour palettes as selectable options, a Write your own field, Skip all and Submit
    The fourth question: three visual directions, picked inline
    Lovable asking to run a command that signs the app preview in as the invited teammate writer at cadencetest.dev to test joining, with Skip and Allow buttons, beside a preview of the generated Cadence landing page
    Lovable asking permission to test its own invite flow as a second user
    Lovable's completion message for the SaaS run: Cadence is live, the whole path was tested end to end including an expired invite link, roles are checked in the database on every read and write, new accounts confirm by email, two test accounts remain
    The completion report, with the two caveats Lovable raised itself

    Why each line is there

    Click a section to see what it prevents

    Lovable's authentication docs say a login request generates the sign-up and login pages and wires them to the backend. The SaaS half is what the prompt has to carry. This is what each section did on the run, and what goes wrong when a line is missing.

    With it

    A small team adopting a tool together, with the invite named as the thing that must work first. Lovable's first question asked who the team is; the answer shaped the workspace model.

    Without it

    A single-user app with a login bolted on, and a workspace model guessed from the app name.

    Context
    With it: A small team adopting a tool together, with the invite named as the thing that must work first. Lovable's first question asked who the team is; the answer shaped the workspace model. Without it: A single-user app with a login bolted on, and a workspace model guessed from the app name.
    Core features
    With it: Auth, workspace, three roles, a tokenised invite and role-gated UI, numbered in that order. All five came back in one build. Without it: Screens before the thing that decides who sees them.
    Access & session rules
    With it: Roles read from the database per request, never from the client. Lovable's completion report repeats the rule back: checked on every read and write. Without it: A role stored in client state that any user can edit in the browser.
    Screens & states
    With it: Inline validation, a member-list skeleton and an empty state that prompts the first invite. Without it: The happy path only, and an alert dialog on the first validation error.
    Build order
    With it: Auth and the route guard, then the role helper, then reads, then the invite write path with the expired-token case. The invite worked because the guard existed first. Without it: Invites that work before the guard exists, and a guard that breaks them when it arrives.
    Safe-guards
    With it: Row-level security as well as UI checks; never a role or workspace id accepted from the client; never a policy weakened to make a query pass. Without it: A hidden button mistaken for access control, which is the failure with its own CVE in Lovable-generated apps.
    Before building
    With it: Four questions, one at a time, then the answers saved to project knowledge so the next prompt builds on them. Without it: Guesses about the workspace model that every later screen inherits.

    After the first build

    The next four prompts, in order

    Each one is a follow-up message in the same project. None is measured yet, so the cost shows a question mark.

    1. 01credits ?

      Define what a plan grants

      A checkout built before entitlements sells something the app cannot tell apart.

      Add a plans table with the limits each plan grants. Enforce the limits in application code and read them per request. No pricing page yet.
      Usage limits & quotas prompt →
    2. 02credits ?

      Take money

      Lovable's Stripe connector needs no paid plan and uses no webhooks by default, so the prompt has to ask for one.

      Connect my Stripe account, create a checkout for the plans, and write a webhook function that is the only writer of subscription status. Verify the signature and store each event once by id.
      Subscription checkout prompt →
    3. 03credits ?

      End the trial

      Trials that never end are the common revenue leak in a generated SaaS.

      On every request compare the workspace's trial_ends_at to now. After expiry, block the gated features, show the expired state with one upgrade action, keep the data readable.
      Trial expiration prompt →
    4. 04credits ?

      Roles that differ by person

      Owner, admin and member exist already. Run this only when those three are not enough.

      Add per-member permissions on top of the three roles, read from the database per request. Do not change the invite flow.
      Teams & permissions prompt →

    Launch checklist

    From preview to a page people can find

    0/7

    Ticks stay on this page while it is open. Steps and plan rules from Lovable's docs, read 23 October 2026.

    If it goes wrong

    Symptom, cause, the line to paste

    A member can open the admin page by typing the URL

    Cause: the role lives in client state and only the menu item was hidden.

    Read the role from the database on every request through one server-side helper. Protect every admin route and query with it. Do not rely on hiding navigation.

    An invite link works twice

    Cause: the token was never marked used, so a forwarded link joins a stranger.

    Mark each invite token used on first join and set an expiry at creation. A used or expired token shows a clear error and a button to request a new invite. Write a test that reuses a token and expects the error.

    Sign-in works until I refresh

    Cause: the session is held in memory and nothing persists it.

    Persist the session across refresh. When it expires, show a re-authentication prompt that returns the user to the page they were on. Never a crash, never a blank screen.

    A query is denied so Lovable loosened the policy

    Cause: a screen failed to render for a member and the shortcut was taken.

    Do not weaken any security policy. If a query is denied, the query is wrong: change the query to read only what the signed-in user's role allows, and show me the policy unchanged.

    Not quite your build?

    14 other Lovable SaaS prompts

    Organic SEOSubscription Checkout FlowA Stripe subscription flow whose states all exist: checkout, success, failure, cancel, and the webhook that keeps the app honest.Organic SocialsProduct Roadmap PlannerA public-or-private roadmap board: columns by stage, drag to reprioritize, and a changelog that writes itself from shipped cards.Email MarketingPayment History & Billing PagesCustomer-facing billing: invoice history, payment method management, and plan changes, driven by Stripe as the source of truth.B2B SalesLead Scoring SystemRules-based lead scoring you can explain to a sales team: transparent point rules, score history, and a ranked queue that updates as behavior happens.Product-led GrowthSaaS Teams & Permissions ManagerTeam management for an existing multi-tenant app: role changes, removals, and transfers that hold up in the database as well as in the UI.Email MarketingCustomer Churn PredictorChurn risk from signals you already store: a transparent risk score per account, the reasons beside it, and a weekly movers list.Product-led GrowthProduct Feature Toggle ManagerFeature flags with tier awareness: flags scoped by plan or percentage, evaluated server-side, with an audit trail of every change.Email MarketingPromo Code & Discounts ManagerPromo codes with the abuse cases handled: creation, redemption, stacking rules, and expiry, enforced at payment time on the server.Email MarketingAI Product Recommendation EngineBehavior-driven product recommendations with an honest fallback ladder: personal history, then similar users, then bestsellers, never an empty shelf.Product-led GrowthSaaS User Onboarding ChecklistAn onboarding checklist wired to live product events: steps complete themselves when the user does the thing, not when they click 'done'.Product-led GrowthSaaS Usage Limits & Quotas ManagerPlan-tier limits that are enforced where they must be and visible where they help: server-side gates with honest usage meters in the UI.Email MarketingSaaS Trial Expiration FlowA trial that actually ends: countdown, honest lockout, data retention, and the reactivation path, driven by dates on the server.Product-led GrowthSaaS In-App Announcement BannerIn-app announcements with targeting and dismissal that stick: plan- and behavior-scoped banners users see once, not forever.B2B SalesSaaS Audit Log ViewerAn append-only audit log with a viewer that answers who did what when: filterable, exportable, and honest about being immutable.

    Pro version · Product-led growth

    The same foundation, with the invite as the growth loop

    The Pro version adds the channel section: what turns the invite flow into acquisition, the instrumentation to see it, and the refinement prompts to run after this one. Unlocked in the bundle, with every other prompt and kit.

    Questions about this prompt

    Does this work on the Free plan?

    Yes, over three days. Our run cost 10.4 credits from plan credits in a paid workspace because the day's 5 daily credits were already spent. On Free that is two days of daily credits plus 0.4 of a third, inside the 30-a-month cap. Nothing in the prompt needs a paid feature; a custom domain and built-in payments do.

    Which sign-in methods can the SaaS offer?

    Per Lovable's authentication docs read on 23 October 2026: email with password or a one-time code, phone, Google, Apple, Microsoft, Sign in with Lovable, SAML SSO and OIDC, all on the built-in backend. Unless you name methods, Lovable sets up email and password, Google and Sign in with Lovable. The prompt starts with email and password on purpose and adds a provider only after the role model works.

    Does Lovable set up row-level security on its own?

    The docs say Lovable sets up these rules automatically when it builds features that store user data, and that the policies are read-only in the database view, so a change goes through chat. They also warn that server code using the service role bypasses the rules and must check permissions itself. The prompt states the rules it wants so the generated policy is the one you meant, and the completion report read them back.

    What were the 4 questions?

    What the SaaS is for and who the team is; how the first workspace should be named at sign-up; how invites should reach teammates for a first version; and which of three visual directions fits. We answered a content-planning tool for marketing teams of three to ten, workspace name asked at sign-up, copyable invite links only, the first palette. The answers went into project knowledge.

    Why do new accounts have to confirm by email?

    Lovable raised it in its completion report as a caveat of the default auth setup. The docs add that users created through Create new user in the Users view are confirmed automatically, which is the quickest way to add a teammate while testing.

    Does Lovable have built-in payments for the next step?

    Yes, two paths per the payments docs read on 22 October 2026: built-in Paddle or Stripe on Pro and above, with Paddle as merchant of record at 5.0% plus 50 cents per transaction, or your own Stripe account on any plan, whose connector uses no webhooks by default. The checkout prompt in this category is written for the second path and asks for the webhook.

    Who ran this

    Marco Kohns wrote the prompt and ran it on 26 September 2026 in his own Lovable workspace. The Pro version and the bundle are our own products. Lovable Prompts is independent and not affiliated with Lovable.

    What we have not tested yet

    • The expired-invite screen on our own screen. Lovable's completion report says it tested the reuse case; we did not screenshot it.
    • A query as a member against the generated policies. The rule was read back by Lovable, not verified by us on this project.
    • The same prompt on the Free plan's daily credits.
    • The 14 other prompts in this category. Their cards show a question mark until we run them.