LazyRoom API

The Laravel backend of a multi-vendor ordering app: customers order meals and groceries from campus suppliers and pay from an in-app wallet. The mobile app was built by a teammate in Flutter; this repository is the backend.

Try the API in your browser → Source on GitHub

Demo accounts

RoleEmailPasswordCan
Customercustomer@lazyroom.compasswordbrowse products, place, cancel and complete orders (wallet: 100 USD)
Suppliersupplier@lazyroom.compasswordmanage products 1–4, accept or reject orders
Adminadmin@lazyroom.compasswordmanage accounts, ban users, deposit and withdraw balances

Try the order flow

  1. In the interactive docs, send POST /api/login as the customer (it is pre-filled) and copy the token.
  2. Paste it as the Bearer token and send POST /api/orders (pre-filled with products 1 and 4). Note the order id.
  3. Log in as the supplier and send POST /api/orders/{id}/accept.
  4. Log in as the customer again and send POST /api/orders/{id}/complete. Check GET /api/balance: the money moved from the customer to the supplier.

What's inside

Order state machineOrders move from pending to accepted, rejected, cancelled or complete, and stock is reserved and restored along the way.
Safe wallet paymentsCompleting an order runs in a database transaction with row locks, so a double click or a retry never charges twice.
Measured under loadOn MySQL, 20 parallel completions of one order charge it exactly once, and 50 parallel orders never overdraw a wallet.
RolesSanctum tokens and role middleware for customers, suppliers and admins.
TestedFeature tests for the payment flow run on every push with GitHub Actions.
DocumentedOpenAPI docs generated from the code, plus a Postman collection.

Free hosting: the server sleeps when idle, so the first request can take up to a minute. This demo runs on SQLite, which has no row locks; the concurrency results above were measured on MySQL. The demo database is reset on every restart.