Back to projects
iOS & Android API

E-commerce Shopping App — Mobile API

Catalog, Cart, Secure Checkout & Order Tracking for Shoppers

Node.jsExpressMySQLRedisStripeJWTFCM
Platforms
iOS + Android
Auth
JWTaccess + refresh
Real-time
FCM push
Payments
Stripe
iOS & Android · REST APIUI concept
E-commerce Shopping App — Mobile API — screenshot

Customer-facing API for a shopping app. Shoppers browse categories, search and filter products, manage a cart and wishlist, check out securely, and follow their orders until delivery. Promotions and coupons are applied server-side.

Architecture & System Design

A Node.js and Express API. Catalog endpoints are read-heavy, so category trees and product listings are cached in Redis and invalidated when products change. Checkout re-prices the cart on the server, reserves stock, creates a payment, and only confirms the order once payment succeeds.

Request Flow
Browse & Search
Cart (server-side)
Re-price & Coupons
Stock Reservation
Payment
Order Confirmed
Tracking Updates
  • Server-side cart pricing so totals can't be manipulated from the app
  • Redis caching for categories and listings keeps browsing fast
  • Stock reserved during checkout to avoid overselling
  • Order status updates pushed to the shopper's device

Engineering Challenges

Overselling Popular Items

Problem

During promotions, many shoppers could check out the last units of a product at the same time.

Solution

Reserved stock atomically at checkout with conditional updates, releasing reservations if payment fails or times out.

Result

Stock levels stay correct even under sudden traffic spikes.

Trustworthy Totals

Problem

Prices, discounts and delivery fees calculated in the app could drift from the server's rules.

Solution

Made the API the only place prices are calculated; the app displays the server's breakdown.

Result

Customers always pay exactly what the business rules say.

Core Features

Catalog & Search

Categories, search, filters and sorting with paginated results.

Clean Code

reserveStock.js
1// Reserve stock for every cart item, or none of them
2"color:#c792ea">export "color:#c792ea">async "color:#c792ea">function reserveStock(db, cart) {
3 "color:#c792ea">await db.transaction("color:#c792ea">async (trx) => {
4 for ("color:#c792ea">const item of cart.items) {
5 "color:#c792ea">const updated = "color:#c792ea">await trx("products")
6 .where("id", item.productId)
7 .andWhere("stock", ">=", item.quantity)
8 .decrement("stock", item.quantity);
9
10 "color:#c792ea">if (!updated) "color:#c792ea">throw "color:#c792ea">new OutOfStockError(item.productId);
11 }
12
13 "color:#c792ea">await trx("carts")
14 .where("id", cart.id)
15 .update({ reserved_until: trx.raw("NOW() + INTERVAL 10 MINUTE") });
16 });
17}

Want something like this for your business?

I design and build full stack products end to end. Tell me about your idea and I'll get back to you with a plan.