Ancient Health
An Ayurvedic e-commerce platform I built solo, from the EC2 deployment to the Razorpay checkout.
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.
Shopping Experience
- 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.
- 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.
- 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.
- 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.
Screenshots
The site as it shipped — across Storefront, Admin. Drag to explore.
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.
Tech Stack
Architecture Decisions
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.
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.
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.
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.
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.
Challenges
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.
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.
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.
By the Numbers
AKSHAT KUMAR
Full-Stack + AI Developer