BoilerPrompt
Replit Agent

Replit Agent prompt to build an e-commerce store

An e-commerce build is a payments integrity problem wearing a storefront. This prompt keeps Replit Agent honest about the hard parts: webhook-verified payment status, price snapshots on orders, and stock decrements inside the paid transaction. You finish with a test-mode Stripe store where the numbers still reconcile after every purchase.

Last updated

Prompt
Build a small e-commerce store in this Repl: React storefront, Express API, the built-in Postgres database, product images in Object Storage, and Stripe in test mode with keys from Secrets. Confirm your plan, then build the storefront before the admin.

Data: products with price_cents, currency, stock, and an images relation. Carts keyed to a session cookie for guests. Orders with line items that snapshot the price paid, never a join back to the live product price.

Storefront: a product grid with image, name, and price. A product page with a gallery and an add-to-cart button that reflects stock, sold out disables it. A cart drawer with quantity steppers and a subtotal. Checkout hands off to Stripe Checkout, with success and cancel routes returning to the store.

Payments: create the Stripe session server-side from cart contents, verify the webhook signature, and only mark an order paid from the webhook, never from the success redirect. Decrement stock inside the same transaction that marks the order paid.

Admin: behind Replit Auth, a product list with create and edit forms, image upload straight to Object Storage, and an orders view showing payment status.

Empty and error states: an empty cart drawer links back to the grid. A failed webhook signature returns 400 and logs. Stock gone at checkout time removes the line, names the item, and recalculates the total.

Done when: I finish a test-card purchase in the webview, the order flips to paid via the webhook, stock drops by the purchased quantity, and the receipt shows the snapshotted prices.

Same task in other tools

Questions about this prompt

Why mark orders paid only from the webhook?

The success redirect can be skipped, replayed, or faked, while the webhook carries a signature your server verifies. Tying the stock decrement to that same transaction means an order is paid and inventory adjusted together or not at all.

I sell digital goods, what should change?

Drop the stock decrement and attach fulfillment to the paid transition instead, for example a time-limited download served from Object Storage. Price snapshotting on order lines stays, refunds and receipts depend on it.

Test checkouts complete but orders stay unpaid, where do I look?

The webhook is not reaching your Repl or the signing secret in Secrets does not match. Check delivery attempts on the Stripe side, then the endpoint logs, a 400 there points straight at the secret mismatch.

Related prompts