Case Study
20253 months soloFull-StackReactKoa.jsMongoDB
Archived · site no longer live

Ancient Health

ancienthealth.in

An Ayurvedic e-commerce platform I built solo, from the EC2 deployment to the Razorpay checkout.

01

Overview

Taking a local Ayurvedic store online.

Ancient Health was a physical store with no online presence, and it could only ship locally. The goal was a storefront where customers anywhere in India could find, browse and order its Ayurvedic products. I built all of it from scratch: a React storefront with product variants, OTP sign-in, Razorpay payments, an admin dashboard, and a Koa.js backend on AWS EC2 behind Nginx, with all media in S3.

02

Shopping Experience

  1. 01Variant-Aware Product Pages

    Each variant has its own price, stock and images. The listed price is always the cheapest available variant, computed in a pre-save hook so the database stays consistent.

  2. 02Guest + Authenticated Cart

    Guests get a localStorage cart with full stock checks. On login, its items merge into their MongoDB cart through a dedicated /cart/merge endpoint, so nothing is lost at sign-in.

  3. 03Category Filtering & Client Cache

    The Shop and Blog pages cache API responses at module level, so going back to them never triggers a new fetch, and no state management library is needed.

  4. 04Razorpay Checkout

    Full payment integration with HMAC-SHA256 signature verification on the backend. An order is confirmed only when the signature matches, so a tampered payment response is rejected.

05

Screenshots

The site as it shipped — across Storefront, Admin. Drag to explore.

www.ancienthealth.in
Home: hero with botanical photography
www.ancienthealth.in/shop
Shop: category filter and product grid
www.ancienthealth.in/shop/ayurvedic-herbal-soap
Product detail with variant selector
www.ancienthealth.in/checkout
Multi-step checkout with Razorpay
ancienthealth.in
Admin: order status pipeline
www.ancienthealth.in/blog
Blog listing with search
deploy.sh
$git push origin main
›Building application...
✓Compiled successfully in 2.4s
✓Static assets optimized
✓Deployed to ancienthealth.in
✓Health check passed — 200 OK
→Shipped to production
06

Deployment

I deployed and configured the whole backend myself: EC2 behind Nginx, S3 for media and Razorpay for payments, from the IAM roles to the reverse proxy.

The platform launched, and the store took orders online from across India for the first time.

07

Tech Stack

Frontend
React 19React Router 7Tailwind CSSFramer MotionGSAP
Backend
Koa.jsKoa RouterJWTbcryptjs
Database
MongoDBMongoose
Payments
Razorpay
Media
AWS S3Sharp
Auth
OTP via NodemailerJWT
DevOps
AWS EC2NginxVercel
08

Architecture Decisions

Koa over Express

Koa's async/await middleware made errors easier to pass through chained steps like payment verification → stock check → order creation. There is no callback nesting, and errors surface where you expect them.

OTP-only Authentication

Every account gets a verified email at signup. Order confirmations and delivery updates go out by email, so an unverified address would break everything after purchase. OTP rules that out from the start.

S3 + Sharp for Image Storage

All image processing (resize to 1000×1000, 80% JPEG compression) runs on the server before upload. The frontend does no image work, which keeps the bundle small and the output consistent whatever the admin uploads.

Guest Cart in localStorage, Authenticated Cart in MongoDB

Forcing login before adding to cart costs sales, so guests get a working localStorage cart. On login, the merge endpoint combines it with the server cart and keeps every item.

AWS EC2 + Nginx Reverse Proxy

The backend was self-hosted on an EC2 instance in ap-south-1, behind Nginx for SSL termination and routing. I picked that over a managed platform to keep costs down and have full control of the server.

09

Challenges

  1. Guest Cart Merge on Login

    The cart started out auth-only, so items disappeared for anyone not logged in. The fix was two cart modes: a localStorage schema matching the server's cart shape, a mergeLocalCart function that POSTs guest items to /api/cart/merge on login, and a backend endpoint that upserts them without duplicating existing items.

  2. Variant-Aware Pricing & Stock Aggregation

    Products with variants needed one price and one stock count for listings, without extra queries on every fetch. A Mongoose pre-save hook walks the variants array, sums the stock, picks the lowest price, and writes both onto the root product document.

  3. Razorpay Payment Verification

    When Razorpay redirects back to the frontend, the payment is only a client claim; the server hasn't confirmed anything yet. The backend recomputes the HMAC-SHA256 signature from the Razorpay order ID and payment ID with the secret key, and marks the order paid only if the signatures match exactly.

10

By the Numbers

13+Pages
6MongoDB Models
AWSAWS EC2 + S3 Deployed
RazorpayRazorpay Payments
OTPOTP Auth
VariantVariant Products
AdminAdmin Dashboard
India-wideIndia-wide Delivery
RoleFull-Stack
Year2025
Timeline3 months solo
StackReact · Koa.js · MongoDB · AWS · Razorpay · Multi-Agent Blog Pipeline
ModulesStorefront + Admin

AKSHAT KUMAR

Full-Stack + AI Developer