Case study — Veyro
A tech store that never gets money or stock wrong.
Veyro sells laptops, phones and accessories on the web and in a companion mobile app. The interesting part isn't the storefront; it's making sure prices, stock and carts stay correct when real people use it at the same time.
- Role
- Solo: design, frontend, backend, mobile
- Platforms
- Web + iOS / Android (Expo)
- Catalogue
- 40 products · 10 categories
- Stack
- Next.js 16 · TypeScript · Supabase · Mailgun

The problem
A shop has to be right about three things the browser can't be trusted with: what something costs, whether it's still in stock, and whose cart is whose. Get any of them wrong and you either lose money or lose the customer.
Architecture
Two clients share one backend. The website and the mobile app talk to the same Supabase project, sign in with the same Google accounts and check out through the same database function.
Web
Next.js 16
server actions · SSR
Mobile
Expo / React Native
iOS · Android
Supabase
Sign-in
Google OAuth
Mailgun
order confirmations
Key decisions
01
Checkout is one database transaction
A Postgres function turns the signed-in user's cart into an order. It reads prices from the products table, never from the browser, locks each product row, rejects the order if stock ran out, writes the order and its items, decrements stock and clears the cart, all or nothing. Two shoppers racing for the last laptop can't both win, and nobody can edit a price in DevTools.
supabase/schema.sql · place_order() for r in select c.quantity, p.name, p.price_cents, p.stock from cart_items c join products p on p.id = c.product_id where c.user_id = v_user for update of p -- lock the rows loop if r.quantity > r.stock then raise exception 'Only % left in stock for %', r.stock, r.name; end if; v_subtotal := v_subtotal + r.price_cents * r.quantity; end loop;02
Row-level security on every table
Products and categories are public to read. Carts, orders and profiles are only visible to their owner, enforced by Postgres itself rather than by app code that could be bypassed. Users can't update orders at all; the one write they need (recording that the confirmation email went out) goes through a narrow security-definer function.
supabase/schema.sql · policies alter table cart_items enable row level security; alter table orders enable row level security; create policy "own orders read" on orders for select using (auth.uid() = user_id); -- place_order() is callable only by signed-in users revoke all on function place_order(...) from public, anon; grant execute on function place_order(...) to authenticated;03
A cart that follows you
Guests shop with a cart kept in the browser. On Google sign-in it is merged into their saved cart in Supabase, capped at available stock and taken out of storage first so it can't be merged twice. From then on the cart syncs live through Supabase Realtime, so adding an item on the phone app shows up on the website instantly.
src/components/CartProvider.tsx // Take the guest cart out of storage synchronously so a // concurrent load can't merge it twice. const guest = readLocal(); writeLocal([]); ... if (rows.length) await supabase.from("cart_items").upsert(rows); // Live sync: reload when this user's cart changes anywhere // (another tab, the mobile app). const channel = supabase .channel(`cart:${userId}`) .on("postgres_changes", { event: "*", schema: "public", table: "cart_items", filter: `user_id=eq.${userId}` }, reload) .subscribe();04
Money as whole numbers
Every amount is stored in kobo as an integer, so there is no floating-point rounding anywhere between the cart, the order and the email. Shipping (free over ₦500,000) and 7.5% VAT are computed in the database from the same constants the UI uses.
supabase/schema.sql · place_order() c_free_shipping_min constant bigint := 50000000; -- ₦500,000 in kobo c_shipping_fee constant bigint := 500000; -- ₦5,000 c_tax_rate constant numeric := 0.075; -- 7.5% VAT
The product

Catalogue with category filter, search and sort

Product page with live stock status

Cart with server-matched totals and free-shipping nudge
Outcome
A working store on web and mobile from one backend: Google sign-in, carts that sync across devices, checkout that prices and reserves stock on the server, and a confirmation email for every order.