home/projects/esales rprc

eSales RPRC Government E-Commerce Platform

Production government e-commerce portal built end-to-end for agricultural and botanical product distribution, featuring automated GST invoicing and dedicated Linux VPS cloud hosting.

My Role

Full-Stack MERN Developer & DevOps (Solo Build)

Timeline

4 Months

Client / Context

RPRC (Govt. of Odisha)

Category

Full-Stack Web

View Live Deployment
React.jsNode.jsMongoDBHostinger VPSNginxDNS
eSales RPRC product preview (screenshot 1 of 2)eSales RPRC product preview (screenshot 2 of 2)

The Problem & Engineering Constraints

The Challenge

Why this system needed to be built

The Regional Plant Resource Centre (RPRC), a premier state government biodiversity and research institute in Odisha, distributed aromatic plants, medicinal herbs, and botanical publications exclusively through manual, in-person cash transactions. They needed a reliable digital storefront allowing citizens to browse catalogs, pay online, and receive automated tax invoices, with a centralized admin dashboard for inventory tracking.

Primary Target Users

Retail customers, botanical research institutions, farmers, and government store administrators.

Real-World Constraints

Non-Negotiables
  • Strict infrastructure budget cap: Must run reliably on an affordable Linux VPS ($8 - $10/month) with zero ongoing cloud service subscription costs.
  • Zero data-loss requirement: Government financial records, order numbers, and statutory GST tax invoices required ACID transactional consistency.
  • Production server orchestration: Sole developer responsible for provisioning the Linux OS, Nginx reverse proxy, SSL certs, DNS routing, and PM2 process management.

*Every architecture decision was framed strictly around these constraints.

System Architecture & Key Decisions

High-Level System Architecture

Engineered with React on the frontend, a Node.js/Express REST backend, and MongoDB database, deployed directly onto a self-managed Hostinger Linux VPS configured with Nginx reverse proxy, Certbot SSL automation, and PM2 cluster management.

Architectural Trade-Off Analysis (Micro-ADRs)

Decision #1

Hostinger Linux VPS with Nginx reverse proxy over managed serverless platforms (Vercel/Heroku)

Why this choice (Rationale):

Satisfied strict government budget constraints ($8/month flat) while giving full control over system daemons, automated cron jobs, and database backups.

Trade-Off Accepted:

Required manual Linux sysadmin responsibilities: configuring firewall (UFW), Nginx gzip compression, SSL renewal, and log rotation.

Alternative Considered:

Managed cloud platforms (AWS Elastic Beanstalk / Heroku)

Decision #2

Automated GST-compliant PDF invoice generation pipeline

Why this choice (Rationale):

Government accounting standards mandated exact sequential order IDs with statutory GST breakdowns generated immediately upon payment confirmation.

Trade-Off Accepted:

Server-side headless PDF rendering can consume CPU bursts; required off-thread generation and stream piping directly to disk and email webhooks.

Alternative Considered:

Client-side window.print() styling

Engineering Challenges & Root-Cause Fixes

Real technical hurdles encountered during production development and how they were solved under the hood.

DevOps & Linux Infrastructure

Zero-Downtime Linux VPS Process Management & Auto-Recovery

CASE #1
1. The Failure / Bottleneck (Symptom)

Uncaught exceptions or memory spikes on a single 2GB RAM Linux VPS risked terminating the Node.js API process, leaving the public government storefront unreachable.

2. Technical Root Cause

Node.js runs single-threaded by default; unhandled rejections would kill the process with no automatic restart mechanism.

3. The Engineered Solution

Configured PM2 in cluster mode across available CPU cores with memory restart thresholds (max-memory-restart 350M), integrated systemd daemon startup, and configured Nginx health check upstream failovers.

4. Quantified Outcome

Achieved 99.9% uptime with automated zero-downtime reloads and self-healing process restarts.

Transaction Integrity & Payments

Payment Webhook Race Conditions & Double-Order Prevention

CASE #2
1. The Failure / Bottleneck (Symptom)

Unreliable mobile network connections caused duplicate webhook delivery and intermittent browser disconnects during payment gateway redirects.

2. Technical Root Cause

Simultaneous payment callbacks were executing order creation and inventory decrement routines concurrently without idempotency checks.

3. The Engineered Solution

Implemented idempotent webhook handlers using unique payment transaction IDs as MongoDB uniqueness keys, wrapped inventory adjustments in atomic database operations ($inc with $gte checks), and validated digital signatures on every callback.

4. Quantified Outcome

100% transaction consistency with zero duplicate orders or inventory discrepancies recorded across production lifetime.

Key Features & Implementation Mechanics

Feature #1

E-Commerce Catalog & Dynamic Cart System

Browse medicinal plant varieties, organic products, and publications with real-time stock availability, categories, and shopping cart validation.

⚙ Under The Hood:

React frontend with persistent local storage cart synchronization and server-side inventory verification before checkout.

Feature #2

Government-Compliant Invoicing & Order Management

Automatic generation of sequential GST tax invoices with transactional email delivery to customers and warehouse staff.

⚙ Under The Hood:

Server-side PDF generation pipeline using PDFKit with dynamic statutory tax breakdown calculation and Nodemailer SMTP delivery.

Feature #3

Admin Dashboard for Inventory & Sales Telemetry

Secure management interface for store staff to update product stock, process dispatch orders, and export monthly sales reports.

⚙ Under The Hood:

Role-protected Express endpoints with JWT authentication, rate limiting, and aggregate MongoDB revenue reporting pipelines.

Verified Metrics & Telemetry

99.9%

Server Uptime

Maintained on a single self-managed Hostinger Linux VPS via PM2 clustering and Nginx reverse proxy.

100%

Order & Payment Consistency

Zero duplicate orders or financial discrepancies due to idempotent payment handlers.

<$10/mo

Infrastructure Operating Cost

Complete production system hosted within government institute budget constraints.

100%

Solo Delivery

Handled full-stack development, payment gateway integration, Linux OS provisioning, and DNS/SSL setup.

Lessons Learned & Architectural Evolution

What Worked Well & Enduring Takeaways

  • ✓Hands-on Linux server administration (Nginx, PM2, UFW, Certbot, systemd) provides unmatched cost-efficiency and deep understanding of network packet flow.
  • ✓Payment gateway integration must always be designed defensively: never trust client-side return URLs alone; the signed webhook is the source of truth.

What I Would Build Differently Today

  • ↺If building today, I would containerize the application with Docker and Docker Compose for even faster environment reproduction and automated rollback capabilities.
  • ↺I would set up a centralized log aggregator (like Grafana Loki or Papertrail) to inspect Nginx access logs and Node.js error traces without SSH-ing into the VPS.