Commerce Engine API

Commerce Engine API

Backend10 September 2025

A scalable backend API powering e-commerce applications with authentication, inventory and payment workflows.

NodeExpressPostgreSQLDocker
01

The problem

Growing online stores need reliable APIs that can handle products, orders, users and transactions efficiently, without the team having to rebuild core commerce logic for every new storefront.

02

The solution

Commerce Engine API provides a robust backend foundation for modern online stores with secure authentication and a scalable, service-oriented architecture. A single API can power multiple frontends, from a web storefront to a mobile app, without duplicating business logic.

03

My role

Designed the API architecture and data model and implemented authentication, inventory and order-processing services.

04

Key features

JWT authentication

Stateless, token-based authentication with refresh tokens, suitable for both web and mobile clients.

Product and inventory management

Endpoints for managing large product catalogs, variants and stock levels with optimistic locking to prevent overselling.

Order processing

A transactional order pipeline that validates inventory, applies pricing rules and records payment state.

RESTful API architecture

A consistent, versioned REST interface with predictable resource naming and pagination.

05

Technical decisions

Containerised the API with Docker to keep local, staging and production environments consistent and to simplify horizontal scaling behind a load balancer.

Implemented database optimization strategies, including targeted indexes and denormalised read models, for handling large product catalogs without slow query times.

06

Challenges & solutions

The interesting part wasn't just building the features. It was figuring out how to make them work reliably, efficiently, and at a scale that wouldn't compromise the experience.

Challenge #1

Preventing overselling under concurrent order requests

Solution

Added optimistic locking on inventory rows and wrapped order creation in a database transaction, so two simultaneous purchases could never both succeed against the same last unit of stock.

Challenge #2

Keeping catalog queries fast as the product count grew

Solution

Introduced targeted indexes and a read-optimised denormalised view for catalog browsing, separate from the normalised write model used for inventory updates.

07

Outcome

The API now serves as the shared backend for several small storefronts, with inventory and order logic centralised so new frontends can be built without reimplementing core commerce behavior.

3
Storefronts powered
0 since launch
Overselling incidents
40+
API endpoints

What I learned

Wrapping order creation in a single transaction with optimistic locking removed an entire category of race-condition bugs that would otherwise have surfaced only under real concurrent load.

Separating the read-optimised catalog view from the normalised write model made a bigger difference to perceived performance than any individual query optimisation.

Available for work
What's next

Like what you see? There's more where that came from.

Every build starts as a rough idea and a two-line email — send yours over and let's see where it goes.