Skip to content
/Arkmantra
E-Commerce / SecurityWebLiverole: Lead Full-Stack & Security Engineer / Database Architect

Arkmantra

Ayurvedic Cosmetics E-Commerce Storefront & Admin

Production Demo
Users
4.9
Rating
12+
Screens
React 19Vite 8TypeScriptReact Router 7Zustand 5TanStack React Query 5Tailwind CSS 4Radix UISupabase (PostgreSQL 15)Supabase Edge Functions (Deno)Razorpay HMAC VerificationPuppeteer-core (Headless SSR)

App Screenshots

Storefront Home
Storefront Home
Shop Catalog & Filters
Shop Catalog & Filters
Rituals & Bestsellers
Rituals & Bestsellers
Brand Story & Philosophy
Brand Story & Philosophy
Case Study

Ayurvedic cosmetics e-commerce with production-grade security

Problem

A D2C storefront that needed full e-commerce capability — product catalogue, cart, checkout, reviews, admin CMS — while defending against price tampering, inventory race conditions, and payment spoofing on a client-side SPA with a public Supabase instance.

What I built

Revoked direct INSERT privileges on orders and routed all mutations through SECURITY DEFINER PostgreSQL RPCs that recalculate totals server-side. Implemented SELECT ... FOR UPDATE row locking for atomic inventory control, HMAC-SHA256 payment verification via Supabase Edge Functions, and a dual-runtime model with offline-first demo state using shimmed auth and localStorage fallback.

Hard parts
  • Anti-price-tampering RPC: all invoice totals recalculated server-side inside a SECURITY DEFINER stored procedure, not trusted from the client
  • Concurrent checkout race conditions solved with transactional row locking (SELECT ... FOR UPDATE) on inventory
  • Dual-runtime architecture: seamless bridge between live Supabase Postgres and a fully functional offline client-side demo with shimmed authentication
Result

Live production storefront with zero price-tampering vectors, atomic inventory, cryptographic payment verification, and a one-click offline demo that runs the entire app without backend credentials.

6
Security Vectors Closed
50+
Headless SSR Routes
4.9
Store Rating

About the Project

Arkmantra is a premium Panchgavya-based natural cosmetics brand. The storefront and admin control panel operates on a dual-runtime model, seamlessly bridging a live production Supabase Postgres cluster with a fully functional offline-first client-side demo state using shimmed authentication interfaces and localStorage caching.

To combat client-side state manipulation (specifically price and discount hijacking), all direct table INSERT privileges for anon and authenticated roles were revoked on orders and order_items. Replaced with transaction-safe, Row-Level-Security (RLS) bypassed PostgreSQL Stored Procedures (RPCs) executing as SECURITY DEFINER. The RPC retrieves base prices, valid coupon objects, taxes, and shipping rates directly from database records, recalculating the invoice totals server-side prior to insertion.

Concurrent checkout requests targeting the same limited inventory units are addressed with transactional row locking using SELECT ... FOR UPDATE on target product keys. Evaluates current inventory bounds against checked-out quantities inside the transaction, decrementing stock levels atomically (update products set stock = stock - quantity) and aborting the transaction if inventory is depleted.

Security is further hardened via client-side size checks and MIME-type restrictions (excluding SVG/HTML), and server-side Supabase Storage bucket security policies. Public contact forms and newsletter subscription endpoints are protected against automated DDoS, spam inserts, and resource exhaustion by removing direct insert policies and routing submissions through stored functions that limit requests to 5 inputs per hour per email address.

Payment confirmation bypasses client-supplied states entirely. Orders initialize as pending and are updated to paid only via a Supabase Edge Function webhook receiver that recalculates the payment token hash utilizing the HMAC-SHA256 algorithm with a server-side RAZORPAY_KEY_SECRET.

Key Highlights

Anti-Price Tampering RPC: Revokes direct orders INSERT privilege, recalculating invoice totals server-side via SECURITY DEFINER Stored Procedure
Atomic Inventory Control: Employs SELECT ... FOR UPDATE row locking inside the placement transaction to prevent stock overselling
Cryptographic Payment Verification: Validates Razorpay webhooks on Supabase Edge Functions utilizing HMAC-SHA256
Database-Driven Reactive Aggregations: PostgreSQL triggers on reviews automatically recalculate average rating cache on affected products
Stored-XSS Prevention: Dual-layer MIME-type validation streams (excluding SVG/HTML) and 5MB storage caps with random UUID renaming
Database Rate Limiting: stored functions rate-limit contact/newsletter entries to 5 submissions per hour per email address
Headless SSR Prerendering: Custom Puppeteer build script prerenders dynamic routes to static indexable HTML files at compile-time
Structured Schema Metadata: Dynamic JSON-LD schemas (FAQPage, BlogPosting, Product/Offer) injected in HTML heads for SEO optimization

Technical Breakdown

Feature areas & implementation details

Customer E-Commerce Experience
Dynamic visual storefront rendering from database catalog models or static seeds (Face Care, Hair Care, Body Care collections).
Advanced product grid with search queries (ILike patterns), price/rating sorting, category filtering, and pagination.
Persistent cart with automatic coupon application limits, GST (18%) taxation, and delivery fee calculation rules (free shipping >= ₹499).
Account panel supporting profile management, avatar uploads, multi-address books, order line history, and verified-purchase reviews.
Administrative Dashboards & CMS
Admin management interfaces featuring secure CRUD operations for Products, Categories, Coupons, and Banner layouts.
Order execution panel mapping status changes (Pending, Shipped, Delivered, Cancelled) backed by transactional confirmation dialogs.
Reviews moderation queue: Product reviews require admin approval; new reviews trigger triggers to re-compute product rating aggregates.
Centralized Site Settings system: Admin dashboard controls global parameters (shipping thresholds, minimum order amount, banners).
Offline Simulation & Security
Runtime detection of Supabase credentials; auto-degrades to sandboxed client-side mode with LocalStorage storage mapping.
Shimmed Auth provider evaluating custom administrative permissions (login: admin@arkmantra.com grants admin dashboard access).
Anti-tampering transactional RPCs, row-level locks, cryptographic webhook validation, and database rate-limiting events.

Other Projects

View All →
Soul33 – The Beacon
Spirituality, Meditation & Mindfulness Platform

A cross-platform spiritual wellness app live on iOS & Android with Free, Seeker ...

Yoke Yoga
Social Wellness, Live Yoga & Learning Platform

Production yoga social platform — TikTok-style Reels, ZEGOCLOUD live streaming +...

Barva Skin Therapie
Ayurveda E-commerce & AR Beauty App

Full-featured Ayurveda beauty e-commerce app with Shopify API, AR lipstick try-o...