# Build a Food Delivery Backend in Lovable

- Tool: Lovable Prompts
- Last updated: June 2026

## TL;DR

This is the hardest app in this prompt library. A three-sided food delivery backend means restaurants manage menus, customers order, and drivers fulfill — with Stripe Connect payouts, real-time order status across all three roles, and multi-role RLS that is genuinely the hardest pattern Lovable handles. No exact food-delivery Lovable build is documented in 2026 research; credit estimates are extrapolated. Budget 250–400 credits and plan to finish in Cursor.

## Frequently asked questions

### Can Lovable really build a three-sided marketplace, or should I just buy ChowNow?

Honest answer: if you're a single restaurant, just use ChowNow at $149/mo flat with no commission. The dev cost of building and maintaining this Lovable app exceeds ChowNow's annual subscription in the first year. Build in Lovable when you are a regional aggregator competing directly with Uber Eats on commission — where owning the platform is the business model — or when you have a niche workflow (B2B catering with corporate accounts, curated ghost kitchens) that ChowNow cannot model. The three-sided RLS complexity is real; community satisfaction with Lovable is documented as lowest for multi-user platforms exactly like this one.

### How do I prevent customers from seeing other customers' delivery addresses?

The orders table RLS SELECT policy for customers is: FOR SELECT TO authenticated USING (customer_id = auth.uid()). This means each customer only ever fetches rows where they are the customer — no customer can see another customer's delivery_address, delivery_lat, or delivery_lng. Verify this in an incognito window with a customer account: run supabase.from('orders').select('delivery_address') in the console. If you see rows belonging to other customers, the policy is missing or has USING (true) — replace it with USING (customer_id = auth.uid()).

### Why does Stripe Connect webhook signature verification fail in Lovable?

The two common causes: (1) you called req.json() or JSON.parse before passing the body to constructEventAsync — this changes the bytes and breaks the signature match. The very first line of your webhook handler must be const rawBody = await req.text(); (2) you used constructEvent (sync) instead of constructEventAsync (async). Deno's WebCrypto is async-only. Use await stripe.webhooks.constructEventAsync(rawBody, sig, webhookSecret). If you see the SubtleCryptoProvider error, that is the second cause.

### How do I handle driver location updates without burning Google Maps quota?

The starter prompt uses Google Maps for geocoding delivery addresses — that is a one-time call per order. Driver location tracking (the 30-second ping) is stored in the drivers table (current_lat, current_lng) and read by customers via Supabase Realtime — no Maps API call per ping. The Google Maps API cost comes from rendering the map tiles and calculating ETAs. To reduce quota: only show the map and request ETA when order.status='en_route', throttle driver pings to 60 seconds instead of 30, and cache the ETA calculation for 2 minutes per order. Google Maps free tier covers 28K map load + directions requests per month.

### Can I add real-time order tracking with Supabase Realtime, or do I need Pusher?

Supabase Realtime handles this well for the scale of a regional food delivery app. The real-time order status follow-up prompt wires Postgres change subscriptions on the orders table to all three role views. Supabase Free tier supports 200 concurrent Realtime connections — enough for hundreds of simultaneous users. Pusher or a custom WebSocket server only makes sense when you exceed 200 concurrent connections or need sub-100ms latency for live GPS tracking, which is a different feature from order status updates.

### What's the commission/payout split logic and where does it live in code?

The split logic lives entirely in the checkout edge function. When creating the Stripe PaymentIntent, set application_fee_amount (your platform's cut in cents) and transfer_data.destination (the restaurant's stripe_account_id). For example, a $20 order with 15% platform fee: total_cents = 2000, application_fee_amount = 300, the remaining $17 automatically routes to the restaurant's connected account via Stripe. The restaurant sees the transfer in their Stripe Express dashboard. You never touch the money — Stripe handles the routing. Adjust the fee percentage in the checkout function constant before going live.

### How do I onboard restaurants to Stripe Connect from inside my app?

The Stripe Connect onboarding follow-up prompt adds this flow. The restaurant clicks 'Connect Stripe Payout Account' in their settings, which calls the stripe-connect-onboard edge function. That function creates a Stripe Express account, saves the account ID to restaurants.stripe_account_id, generates a Stripe AccountLink (the hosted onboarding URL), and redirects the restaurant to Stripe's onboarding flow. After completion, Stripe redirects back to your return URL where stripe-connect-return verifies the account is charges_enabled. Until stripe_account_id is set and charges_enabled is true, customers cannot check out from that restaurant.

### Is this build suitable for a real launch, or should I hire a dev team?

This prompt kit gets you to a working MVP suitable for a closed beta with a handful of real restaurants and drivers. For production launch with real money flowing through Stripe Connect, you should: run the three-account RLS audit follow-up prompt, export to GitHub, do a manual code review of the checkout and webhook edge functions, and set up Stripe fraud monitoring. If scope expands to PCI compliance, driver background-check workflows, POS integration, or white-labeling for multiple operators, you're past Lovable's wheelhouse. If your build outgrows this prompt kit and you need custom architecture, RapidDev builds production-grade Lovable apps at $13K-$25K — book a free 30-minute consultation at rapidevelopers.com.

---

Source: https://www.rapidevelopers.com/lovable-prompts/lovable-prompts-for-building-food-delivery-backend
© RapidDev — https://www.rapidevelopers.com/lovable-prompts/lovable-prompts-for-building-food-delivery-backend
