Lovable prompt log: Folioport (before)

Source file: before/LOVABLE_PROMPTS.md

Reconstruction for replay. These prompts were written to reproduce the before/ app, not copied from a real Lovable session. Pasted in order into a fresh Lovable project with Supabase connected, they lead to an app with the same shape and the same flaws. Lovable's output will differ in details (file names, copy, colours, exact policies), and a newer Lovable may push back on some of the riskier requests (its security scan may flag the service key or disabled RLS); the prompts are written the way a founder clicks past those warnings. The result is intentionally vulnerable: build it in a throwaway project with fake data and never publish it.

Voice: a non-technical founder who runs a small design agency. Typos and vagueness are deliberate.


1

Build me a web app called Folioport. Its a client portal + invoicing tool for small creative agencies (design studios, social media agencies). Agencies can add their clients, create projects, send invoices and get paid online. Clients get their own login where they can see their invoices and pay them and message about the project. Make it look modern and professional, like a real SaaS. Start with a landing page and login/signup.

2

Connect Supabase. I need tables for agencies (organizations), the people in them, clients, projects, invoices with line items, messages on projects, and payments. When someone signs up they should create their agency and be the owner.

3

The landing page looks a bit plain. Make the hero more eye catching with a gradient (indigo to purple), a little badge on top that says "Now with AI-powered invoicing", and the headline "Streamline your agency workflow". Add 3 feature cards with icons and a section with emoji bullet points about why agencies love us, plus a testimonial and a call to action at the bottom.

4

Make a dashboard after login with cards for Total Revenue, Outstanding, Overdue and Active Projects, a revenue chart and a recent invoices table. Use the sidebar layout.

5

Add an Invoices page with tabs for draft/sent/paid, search, and a New Invoice form where I pick the client and project and add line items with quantity and price. The total should add up automatically. Clicking an invoice opens a detail page with the line items and the total.

6

When I try to create an invoice I get this error:

new row violates row-level security policy for table "invoices"

Please fix it so I can save invoices.

(Lovable typically proposes a policy first. The founder replies with prompt 7 when the next table fails.)

7

Now the same error happens for invoice_items and clients and payments. I just need this to work, I'm demoing to an agency friend tomorrow. Can you just turn off whatever is blocking it for these tables?

(This is where RLS gets disabled on clients, invoices, invoice_items and payments: [FM1]. For organizations, profiles and memberships the "fix" is a policy that allows everything: [FM2].)

8

Add a Team page that shows everyone in my agency with their name and email and role. Add an "Invite teammate" button where I type their email and pick a role.

9

The team page shows names but the emails are empty. Can you get the emails from the users table so they show up?

(Produces the team_directory view over auth.users: [FM11].)

10

Inviting doesn't work, it says "permission denied for table memberships" and sometimes "User not allowed". Also deleting a client fails with an error about a foreign key. Use the admin key or whatever is needed so admins can invite people and delete clients. I added the service role key to the project secrets.

(The service role key ends up as VITE_SUPABASE_SERVICE_ROLE_KEY behind an adminClient in the browser: [FM4].)

11

Clients (our customers) should be able to log in too. When I invite someone with the role "client" and link them to one of my clients, they should only see a simple portal with their own invoices and project messages, not the admin stuff like dashboard, clients and team. Hide those for them.

(Hiding is all it does: [FM5].)

12

Add role based permissions so only owners and admins can create and edit projects, and members of the agency can see their own projects and messages. Store the role on the user so its easy to check.

(Role stored in user_metadata and read by the projects/messages policies: [FM12].)

13

In Settings let users edit their name, phone, and their role, and the agency name.

14

Add a "Pay now" button on the invoice page for clients that takes them to Stripe checkout for the invoice amount. When they come back after paying, mark the invoice as paid and show a success message.

(Amount sent from the browser; the ?paid=1 return URL flips the status client-side: [FM6].)

15

Some invoices are showing as paid even though I don't see the money in Stripe yet, and some that were paid stay "sent". Set up a Stripe webhook so the invoice gets marked paid when Stripe confirms the payment, and record the payment and email the client a receipt.

16

The webhook isn't working. Stripe dashboard shows the deliveries failing and the function logs say:

Webhook signature verification failed: No signatures found matching the expected signature for payload

Please fix the webhook so payments go through.

(The signature check gets commented out instead of switching to the raw body: [FM7], [FM8]. Nothing stops duplicate deliveries: [FM9].)

17

Add a "Send invoice" button that emails the invoice to the client's contact email with the invoice details.

(An edge function with no auth check and no rate limit that takes the recipient from the request: [FM13], [FM17].)

18

The dashboard is getting slow. Can you make the revenue chart faster? Maybe do the calculation in the database.

(Produces get_org_revenue as security definer with no membership check: [FM11]. The N+1 invoice loading that actually makes the page slow stays.)

19

Sometimes when I open an old invoice link the whole screen goes white. Not urgent, but can you make the invoice totals always correct by recalculating them from the line items whenever we load the list?

(Totals get re-summed in the browser from float dollars on every load, adding two requests per invoice. The white screen, caused by a missing null check and no error boundary, stays.)


What the log leaves behind is documented in before/README.md, and before/exploits/run-all.ts proves each flaw against local seed data.