BoilerPrompt
Lovable

Lovable prompt to build an e-commerce store

Storefronts punish shortcuts, client-trusted prices and webhook double-fires turn into real financial bugs. This prompt directs Lovable to keep Stripe amounts server-side in an edge function, record orders only after payment succeeds, and guard inventory at both the picker and the webhook, so the store handles money carefully from the first checkout.

Last updated

Prompt
Build a small e-commerce store with a public catalog, a cart, and Stripe checkout.

Catalog: a products table with name, slug, price_cents, inventory_count, and images in a product-images storage bucket, a grid at /shop with category filter chips, and a product page with an image gallery and a quantity picker capped at available inventory.

Cart: stored in localStorage for guests and merged into a carts table on login, a slide-over cart panel with quantity steppers per line, and a subtotal that updates on every change. Out-of-stock items in a saved cart show a notice instead of failing silently at checkout.

Checkout: an edge function named create-checkout builds a Stripe Checkout session from server-side prices, never trusting amounts sent by the client, and a webhook function records the order and decrements inventory_count only after payment succeeds. Orders land in an orders table with line items and a status field.

Account: an order history page listing past orders with status and totals.

States: an empty cart panel with a link back to the shop, a payment-cancelled return page that keeps the cart intact, and a sold-out badge on depleted products.

Styling: product imagery dominant, a whitespace-heavy grid, and price typography consistent across card, product page, and cart.

Acceptance: adding beyond inventory is blocked at the picker, a completed test payment produces one order row and reduces inventory exactly once even if the webhook retries, guest carts survive a refresh, and a cancelled checkout creates no order.

Same task in other tools

Questions about this prompt

Do I need Stripe configured before running this prompt?

You can generate the storefront first, but checkout needs your Stripe secret key stored as a Supabase secret and the webhook URL registered with Stripe. Lovable scaffolds the functions either way, they fail loudly until keys exist.

How do I handle variants like size and color?

Add a variants table with its own price and inventory per row, and ask Lovable to move the picker and stock checks to the variant level. Do it before real orders exist, migrating line items later is painful.

Inventory goes negative under rapid repeated purchases. Fix?

Decrement inside the webhook with a conditional update that checks remaining stock, not a read-then-write from the client. Ask Lovable to make that update atomic and to reject the order path when stock runs out.

Related prompts