DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk6 min

Stateful vs. Stateless Frontends: Designing a Food Delivery App One State at a Time

Stateful versus stateless is not one switch for a whole app. Here is how to decide where each food delivery state belongs: the URL, the cart, checkout, or the server.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A food delivery frontend is not simply stateful or stateless. Each piece of information needs its own answer to four questions: who owns it, how long it must live, who needs to read or change it, and how it comes back after a refresh or a page change. The restaurant search filter, the menu, the cart, and the order status in one app can each land in a different place, and mixing them up is where most bugs start.

Why “stateful or stateless” is the wrong switch

The phrase blends two different scopes. Inside the browser, the question is where a given value lives: in a component, in the URL, in browser storage, or on a server. Across the backend, the question is whether a server keeps memory of a user between requests. A well-built app can have stateless request handling on the server and rich, deliberate state in the browser at the same time. The rest of this article works through the browser side first, then explains what “stateless” means on the server.

As an Amazon Associate I earn from qualifying purchases.

The examples below are architectural illustrations of how a food delivery journey could be structured. They are not descriptions of how any particular commercial app is built.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Four questions to ask about every piece of state

  • Owner: which layer holds the value: a single component, a route, the browser, the server, or the database.
  • Lifetime: whether it lasts for one interaction, one page visit, until a refresh, or as a durable record.
  • Sharing: whether it is used by one component, several routes, or several users and devices.
  • Recovery and exposure: whether it must survive refresh, whether it should appear in a link, and what happens if it is exposed or tampered with.

The table below applies those questions to typical delivery-app data. The entries describe the design logic, not measured behavior of a specific product.

Data Typical owner Typical lifetime Survives refresh? Shareable by link?
Whether a dish-options popover is open Component local state One interaction No, by design No
Cuisine filter, sort order, page number URL Until the URL changes Yes Yes
Unsubmitted cart draft Client-side store or browser storage, if the product keeps it Until cleared, expired, or the device changes Depends on the storage chosen No
Restaurant and menu records Server or database, read by the frontend Owned by the service; the frontend holds a copy Yes, when refetched Via an ID in the URL
Order and payment outcome Server and database Durable record Yes Via an order ID, with access controls

Walking the order journey, one state at a time

Browsing restaurants

A selected location, search term, cuisine filter, sort order, or page number belongs in the URL when people should be able to refresh the page, bookmark it, or send it to someone else. Salesforce’s Storefront Next state-management guide describes URL state in exactly these terms, and it notes that route-level data loading can read values from the URL. A search for “noodles, open now, sorted by delivery time” then works the same way on refresh and in a shared link.

Transient interface details are a different matter. Whether a small tooltip is visible or whether a dropdown is expanded has no value to another visitor, so it can stay in local component state. Putting it in the URL would clutter links and create history entries nobody wants.

Restaurant and menu data

Restaurant records and menu items returned by the API are owned by the service. The frontend should treat them as remote data: fetch them, display them, and refetch when they may be stale. Copying them into a long-lived client store and editing them locally invites the frontend to disagree with the menu the kitchen actually has. The Storefront Next guide separates server or remote data from local UI state for this reason, and the React documentation on managing state makes the broader case for keeping state in the place that actually needs it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The cart draft

Whether a cart survives navigation, a refresh, a sign-in, or a switch to another device is a product decision. The state-management guidance does not decide it for you. A reasonable design is to keep the draft in a client-side store, persist it to browser storage if the product requires it, and write it to the server only when the customer commits to something, such as applying a promotion or starting checkout.

Whatever you choose, derive display values from the items instead of storing them separately. The React documentation names this problem directly: if a subtotal is stored next to the item list, the two can drift apart after an edit. Store the items and compute the subtotal, delivery fee estimate, and item count from them on every render.

Checkout

Checkout is where local state and server authority meet. The frontend should represent submission as explicit UI states: idle or typing, submitting, succeeded, and failed. The React documentation demonstrates this pattern for forms, with separate states for typing, submitting, success, and error.

Those frontend states describe what the browser is doing, not what the business has committed to. In a real payment flow the server must remain the authority for creating the order and recording the payment outcome. A frontend that marks an order as placed the moment the button is pressed has only shown a spinner that ended. Wait for the server’s response, and treat a timeout as unknown rather than as success or failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Order confirmation and tracking

Order status is server-owned data. The interface can show a pending or optimistic message while a write is in flight, which makes the app feel responsive, but it should replace that message with the authoritative response when it arrives. Once a write completes, most routing setups reload the route’s data so the screen reflects the saved state.

The reviewed guidance establishes the distinction between remote data and optimistic state. It does not prescribe a particular polling, push, or refresh interval for tracking, so choose one based on how quickly your order statuses change and what your backend can support.

What “stateless” means when the backend is stateless

Shopgate’s app architecture documentation describes a setup in which incoming requests are load-balanced across containers, while app state is kept in a database. A request token carries the app, user, and session context to the data layer. In that design, “stateless” refers to the containers handling requests, not to the application as a whole. The data still has state; it lives in a database rather than in the process that answers a request.

That pattern lets any container serve any request, which simplifies scaling and restarts. It is one platform’s documented design, not a general requirement, and the page does not present it as proof of scalability. Use the term with its scope stated, for example “the API containers are stateless; order state is stored in the database.”

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Isolate per-user state during server rendering

If the frontend renders on the server, the store that holds user-specific data must be created fresh for each request. Redux’s server rendering guidance says to create a new store per request. A module-level store shared across requests can expose one visitor’s cart, address, or order history on another visitor’s page. This is one of the few places where a single shared object is a real security problem rather than a style choice.

The duplicated-state mistake

The React documentation states plainly: “Redundant or duplicate state is a common source of bugs.” In a delivery app, the usual forms are a stored subtotal next to the cart items, a copied restaurant name inside every cart line, and an “order is complete” boolean alongside a status field that can also say complete. Each duplicate is another value that must be updated in every path that changes the original, and one missed path shows the customer a different total than the one they will be charged.

What to decide first

  1. List every piece of data the journey uses, including filters, cart items, addresses, and order status.
  2. For each item, answer the four questions: owner, lifetime, sharing, and recovery.
  3. Move anything a customer might bookmark or share into the URL, and keep it out of the URL if it is only interface detail.
  4. Store remote records as fetched copies that can be refetched, and never edit them as if they were the source of truth.
  5. Write the cart-persistence rule down as a product decision, including what happens on refresh, sign-in, and device change.
  6. Remove stored values that can be computed from other stored values.
  7. Make the server response, not the button press, the event that marks an order as placed.
  8. If you render user-specific pages on the server, create a new store for every request.

Frontends are stateful wherever a customer’s interaction has meaning, and they should stay stateless about anything the server can recompute or should own. Deciding that one value at a time is what keeps a food delivery app correct as its features grow.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.