Selected work / Commerce / Backend engineering

Fastify E-Commerce Platform

Money, inventory, and a clearly defined order lifecycle.

One order.Every transition matters.

The difficult part of commerce is what happens around a retry, the last item in stock, or a payment arriving twice.

Follow the story
The thinking behind the build
  • Fastify
  • TypeScript
  • PostgreSQL
  • Redis
Explore the repository
Built for
Exploring a real engineering problem
Format
Repository-based architecture study
Evidence
Source reviewed / demo not published here

01 / The problem

The difficult part begins at checkout.

Creating an order touches inventory, ownership, payment confirmation, and fulfillment. The API makes these state transitions explicit, with separate paths for stock management and payment verification.

From the friction → to the system

02 / Architecture

Make the lifecycle explicit.

Follow one journey through the system.

System / Fastify E-Commerce Platform01 — 04
  1. 01
    CreatedIdempotency-Key + stock
  2. 02
    PaidVerified Razorpay handler
  3. 03
    ProcessingFulfillment begins
  4. 04
    ShippedThen delivered
Architecture illustration / source reviewed
Not a product screenshot
01 / 04

Created

Order creation requires an idempotency key. Inventory updates use row locks inside a transaction.

02 / 04

Paid

Razorpay confirmation and webhook handlers verify signatures. The separate manual pay shortcut still needs production gating.

03 / 04

Processing

Payment hands the order to fulfillment. Processing is an explicit state, rather than an implicit side effect.

04 / 04

Shipped

Shipping leads to delivery. Cancellation is restricted to the created state, before the payment and fulfillment path.

Outside the main path

Fastify + TypeScript with PostgreSQL. The lifecycle is CREATED → PAID → PROCESSING → SHIPPED → DELIVERED. Cancellation is limited to CREATED. Product/inventory management includes audit logging and role-based access.

Inside the implementation

The details
make the difference.

A closer look at the decisions, boundaries, and work still ahead.

Engineering notes / 01

Retries and the last item

Order creation requires an Idempotency-Key. The query checks for an existing order and returns its order_id when that key is found. A unique database index backs the key.

Inventory queries use FOR UPDATE within a transaction. This is a concrete concurrency mechanism, not a substitute for a measured simultaneous-order test. Request ownership and reuse of the same key with different inputs also deserve review.

Engineering notes / 02

Payment is a verified event

Razorpay confirmation and webhook handlers verify signatures. Fulfillment moves through processing, shipped, and delivered states rather than treating payment as the end of the order lifecycle.

A manual pay route also exists. It is a testing shortcut, not a secure payment-confirmation mechanism. The reviewed routes do not establish that it is disabled in production; that must be resolved before presenting this API as production-ready.

Engineering notes / 03

Operational tradeoffs

The repository includes email notifications, rate limiting, API versioning, Redis caching, and Docker/CI support. An in-memory cache fallback is process-local, so multiple API instances would not share that fallback state.

Before deployment, verify duplicate and out-of-order webhooks, cancellation authorization, concurrent inventory updates, and cache behavior across instances. A reproducible test run and API walkthrough would provide stronger evidence than a feature list.

Scope & evidence

What this page establishes.

Implementation study with verified source paths. No payment reliability, test-coverage percentage, or production-readiness claim is made.