RazorShop is an enterprise-grade e-commerce platform and AI-powered revenue recovery manager designed for modern online merchants. It combines a high-converting customer storefront, an embedded Razorpay checkout pipeline, automated payment failure recovery workflows, order cancellation & return logistics management, voice-enabled AI merchant assistance, and comprehensive analytics.
- Production Site: https://razorshop.app
- GitHub Repository: https://github.com/NematSachdeva/RazorShop
E-commerce businesses lose a significant portion of their revenue due to transient payment failures, abandoned checkout carts, manual return/refund friction, and operational delays in seller workflows.
RazorShop addresses these challenges by uniting a full-featured online marketplace with intelligent automation:
- High-Converting Customer Storefront: A responsive, fast, and accessible customer portal with product discovery, category filtering, cart management, and seamless Razorpay checkout.
- Automated Revenue Recovery Engine: Real-time detection of failed payment attempts and abandoned carts, generating AI-driven recovery cases, personalized communication, and customer promise-to-pay tracking.
- Multi-Modal AI Merchant Helper: A natural language AI assistant supporting text and voice commands (via Groq Whisper V3 Speech-to-Text and Sarvam AI Bulbul V3 Text-to-Speech) for catalog updates, stock adjustments, deal creation, order cancellations, and refunds.
- End-to-End Fulfillment & Return Logistics: Full order status tracking from placement to delivery, including a 5-stage return logistics pipeline with automatic stock restoration upon return completion.
- Multi-Tenant Merchant & Admin Portals: Dedicated seller workspaces for inventory and order operations, alongside an administrator portal for merchant application review, approval provisioning, and audit trails.
- Storefront & Catalog Browsing: Dynamic grid view with deal badges (
POPULAR,ONLY X LEFT), original vs. discounted pricing, ratings, and stock status. - Search & Filtering: Real-time search across product names and descriptions, category selection, price range (
Min/Max), andIn Stock Onlyfilters. - Sorting & Pagination: Sort by Newest/Recommended, Price (Low to High / High to Low), and Name (A–Z / Z–A) with server-side pagination.
- Product Details & Recommendations: Rich modal view with high-resolution imagery, inventory checks, product overview, and AI-driven cross-sell recommendations.
- Sliding Cart Drawer: Real-time cart drawer with quantity controls, item removal, bundle offer banners, and dynamic total calculations.
- Delivery Address Book: Multi-address management allowing default selection, creation, editing, and deletion.
- Razorpay Checkout: Seamless payment modal integration supporting card, UPI, and net banking options.
- Customer Order Tracking: Dedicated order history page with interactive 4-stage delivery timeline (
Pending→Confirmed→Dispatched→Shipped→Delivered), order receipts, and return status tracking. - Order Cancellation & Return Requests: Self-service cancellation before dispatch and structured return requests.
- Order Feedback: Post-delivery rating (1–5 stars) and category feedback submission.
- Light / Dark Mode: Theme switcher with persistent preferences stored in
localStorage.
- Real-Time Dashboard & Analytics: Live tracking of Total Revenue, Revenue at Risk, Recovered Revenue, Failed Payments Count, Abandoned Carts Count, and Cancellation/Return metrics.
- Catalog & Inventory Management: Interactive catalog manager supporting product creation, catalog editing, deal creation (discount percentage and expiration timer), image uploads, and soft-deletion/archiving.
- Stock Inventory Adjustment: Inline stock editor supporting
Add Stock,Remove Stock, andSet Exactoperations on hand and available quantities. - Order Fulfillment & Shipping Controls: Filterable order tables with status transition actions (
Dispatch,Ship,Deliver). - Cancellation & Return Logistics Management:
- Review and approve/reject customer return requests.
- Track 5-stage return logistics:
Pickup Scheduled→Picked Up→In Transit→Returned to Seller→Refund Initiated. - Automated stock restoration triggered strictly upon return arrival to seller (
Returned to Seller). - Manual merchant refund initiation with payment verification audit trail.
- Recovery Cases Hub: Table of active recovery cases filtered by status (
Open,In Progress,Resolved,Abandoned,Customer Declined), manual recovery email triggers, and timeline histories. - Merchant Helper (AI Assistant): Text and voice interaction interface for executing stock updates, deal creation, order queries, and return approvals.
- Merchant Guardrails Configuration: Editable business parameters including max recovery attempts, max discount percentages, allowed communication channels, promise-to-pay limits, and AI feature toggles.
- Merchant Application Status View: Real-time status tracker for onboarding applications (
pending,approved,rejected).
- Merchant Onboarding Applications: Portal for inspecting seller registration requests.
- Application Review Workflow: Approve applications (automatically provisioning seller credentials and upgrading user roles) or Reject applications with mandatory feedback.
- Application Metrics & Audit Trail: Overview of total, pending, approved, and rejected applications alongside detailed timeline audit logs.
- RESTful API: Clean Express route structure for auth, catalog, cart, checkout, payments, orders, merchant operations, admin workflows, and recovery.
- TypeORM Entity Layer: Strongly typed PostgreSQL database models and migrations.
- Idempotent Webhook Processing: Secure Razorpay webhook handler with raw body HMAC-SHA256 signature verification.
- Background Scheduler: Automated background cron runner for recovering abandoned carts, checking payment timeouts, and expiring active deals.
- Multi-Tenant Isolation: Merchant routes scoped strictly to seller-owned products, orders, and configuration.
- AI Cart & Product Recommendations: Groq LLM-driven recommendation engine suggesting complementary products and bundle discounts.
- AI Recovery Email Generator: Groq LLM-generated personalized recovery emails tailored to failure reasons.
- Voice Transcription (STT): Groq Whisper Large v3 voice-to-text with auto-script verification and targeted Hindi retry logic.
- Text-to-Speech (TTS): Sarvam AI Bulbul v3 TTS speech synthesis (
speaker: shubh) for audio voice responses.
[ Client Web Browser ]
│
▼
[ Nginx Reverse Proxy ]
(Port 443 / SSL Terminated)
/ \
Static Assets /api Proxy
│ │
▼ ▼
[ React / Vite Frontend ] [ Express Node.js Backend ]
(Dist Assets in /var/www) (PM2 Daemon / Port 7070)
/ │ \
/ │ \
▼ ▼ ▼
[ AWS RDS ] [ Razorpay ] [ Groq AI ]
(PostgreSQL) (Payments) (LLM & STT)
| Role | Access Level & Responsibilities |
|---|---|
customer |
Default public/registered user role. Can browse catalog, manage cart, save shipping addresses, place orders, complete payments, track delivery timelines, submit feedback, and initiate cancellations/returns. |
merchant |
Approved seller role. Grants access to the Merchant Portal for managing product catalog, inventory stock, order fulfillment, return logistics, recovery cases, merchant configuration guardrails, and AI Merchant Helper. |
admin |
System administrator role. Access restricted to Admin Portal routes (/api/admin/*) for reviewing merchant applications, approving/rejecting seller onboarding, and inspecting audit trails. |
The Customer Portal provides a modern, fast shopping experience:
- Navigation & Routing: HTML5 History API routing supporting
/,/orders,/privacy,/terms,/support,/status. - Search & Filter Bar: Real-time text search, price sliders, in-stock filters, category chips, and sort selectors.
- Product Details & Recommendations: Interactive product detail dialog featuring stock badges, full descriptions, pricing, and AI recommendations.
- Sliding Cart Drawer: Right-side drawer for quick cart adjustments, bundle discount triggers, and checkout initiation.
- Delivery Address Management: Customer address modal to create, edit, select default, or delete delivery addresses.
- Checkout Modal: Summarizes selected shipping address, cart line items, discounts, and total payable amount before launching payment.
- Payment Page Modal: Intermediate payment gateway loading screen handling Razorpay Checkout modal launch and payment verification.
- Order Tracking Page: Displays customer order history with real-time status badges, line items, breakdown, address details, and cancellation/return request triggers.
The Merchant Portal equips store owners with operational tools:
- Overview Dashboard: High-level KPI summary cards and daily revenue performance charts.
- Products & Stock Tab: Data table listing all merchant products, stock counts (On Hand, Reserved, Available, Sold), quick inline stock editor, product creator/editor modal, and archiving controls.
- Orders & Fulfillment Tab: Filterable order manager for changing fulfillment status (
Dispatched,Shipped,Delivered) and processing return requests through 5 logistics stages. - Recovery Cases Tab: Management table for open and in-progress recovery cases with manual email dispatch options and case decision logs.
- Merchant Helper: Interactive text/voice AI chat drawer for natural-language store management.
- Merchant Configuration Modal: Control guardrail limits for discounts, recovery attempts, communication channels, and promise-to-pay rules.
The Admin Portal handles platform governance:
- Application Queue: Overview of pending, approved, and rejected seller applications.
- Application Review Modal: Detailed inspection of seller application metadata (business name, tax ID, store description, contact info).
- Approval & Provisioning: Approving an application automatically provisions a
Merchantdatabase entity and upgrades the applicant's user account role tomerchant. - Rejection Workflow: Rejecting an application records a mandatory rejection reason and updates timeline logs.
- Audit Logs: Full timeline history of administrator actions and status changes.
- JWT Tokens: Authentication uses JSON Web Tokens signed with
JWT_SECRET(7-day validity). Tokens are stored inlocalStorageand passed in theAuthorization: Bearer <token>HTTP header. - Password Protection: User passwords are encrypted using
bcryptjswith salt rounds of 10. - Role-Based Access Control (RBAC): Middleware functions enforce strict authorization:
createAuthenticate: Decodes JWT token and attaches user payload toreq.user.requireCustomer: Restricts route to authenticated customers.requireMerchant: Restricts route to authenticated merchants.createRequireApprovedMerchant: Ensures merchant's application status isapproved.requireAdmin: Restricts route to system administrators.
id(UUID primary key)name,category,description,image_urlprice_cents(BigInt in cents, e.g.299900= ₹2,999.00)original_price_cents,discount_percentdeal_active(Boolean),deal_expires_at(Timestamp)merchant_id(Foreign key linking product to seller)
quantity_on_hand: Physical stock quantity present in warehouse.reserved: Quantity currently held in active customer carts/orders.available: Calculated asmax(0, quantity_on_hand - reserved).
- Item Added to Cart: Increments
reservedcount by item quantity. - Item Removed / Cart Expired: Decrements
reservedcount by item quantity. - Order Confirmed: Deducts item quantity from
quantity_on_handand clearsreserved. - Order Cancelled / Returned: Restores
quantity_on_handupon cancellation or when return arrives back to seller (Returned to Seller).
Customer Checkout ──► Order Created ('pending')
│
├── Payment Successful ──► Order Confirmed ('confirmed')
│ │
│ ├── Merchant Dispatches ──► 'dispatched'
│ │ │
│ │ ▼
│ │ 'shipped'
│ │ │
│ │ ▼
│ │ 'delivered'
│ │ │
│ │ ▼
│ │ Return Requested ('return_requested')
│ │ │
│ │ ├── Return Approved ('return_approved')
│ │ │ │
│ │ │ ▼
│ │ │ 'pickup_scheduled' ──► 'order_picked_up'
│ │ │ │
│ │ │ ▼
│ │ │ 'return_in_transit'
│ │ │ │
│ │ │ ▼
│ │ │ 'order_returned_to_seller'
│ │ │ (Stock Restored)
│ │ │ │
│ │ │ ▼
│ │ │ 'refund_initiated'
│ │ │
│ │ └── Return Rejected ('return_rejected')
│ │
│ └── Pre-Dispatch Cancel ──► Order Cancelled ('cancelled')
│
└── Payment Failed ──► Trigger Payment Failure & Recovery Engine
RazorShop uses Razorpay Payment Gateway for customer transactions:
- Payment Creation: Frontend calls
POST /api/payments/createwithorder_id. Backend creates a Razorpay Order via Razorpay API and records aPaymentAttemptrow. - Razorpay Modal: Frontend launches Razorpay Checkout dialog using the generated
razorpay_order_idand publicRAZORPAY_KEY_ID. - Payment Verification: Upon completion, frontend sends
razorpay_payment_id,razorpay_order_id, andrazorpay_signaturetoPOST /api/payments/verify. Backend verifies the HMAC-SHA256 signature usingRAZORPAY_KEY_SECRET. - Webhook Handling:
POST /api/webhooks/razorpayreceives raw webhook payloads, verifies HMAC-SHA256 signature againstRAZORPAY_WEBHOOK_SECRET, and processes payment events asynchronously.
- Payment Failure: When a payment attempt fails or errors out, backend registers a
PaymentFailureentry and initializes aRecoveryCase. - Abandoned Cart: Background scheduler identifies active carts untouched past threshold windows and initializes recovery workflows.
- Case Creation: A
RecoveryCaseis created inopenstatus. - AI Failure Diagnosis:
GroqEmailGeneratoranalyzes failure context (e.g. card decline, timeout, insufficient funds) and generates personalized recovery emails. - Communication Dispatch:
EmailServicesends recovery emails containing single-click payment recovery URLs (EMAIL_DELIVERY_MODEsupportsmockorlivevia Resend API). - Customer Response Tracking: Customers can accept recovery, promise to pay later (
PromiseToPayentry), or opt out (customer_declined). - Resolution: Successful recovery updates
RecoveryCasestatus toresolvedand tracks recovered revenue metrics.
The Merchant Helper is a multi-modal AI copilot:
- Capabilities: Query store analytics, update stock levels, create promotional deals, process refunds, approve returns, and cancel orders.
- Groq LLM Integration: Uses Groq API for natural language understanding, intent extraction, and response generation.
- Voice Input (STT): Transcribes recorded user audio (
webm,wav,m4a) using Groq Whisper Large v3 with fallback script validation. - Voice Output (TTS): Converts text responses into spoken audio using Sarvam AI Bulbul v3 (
speaker: shubh). - Interactive Action Confirmations: High-impact actions (price modifications, stock changes, refunds, cancellations) return structured action proposal cards requiring explicit merchant confirmation before execution.
The Merchant Analytics engine calculates real-time metrics:
- Total Revenue: Sum of all confirmed/delivered order amounts.
- Revenue at Risk: Total value of open recovery cases and abandoned carts.
- Recovered Revenue: Total value of orders successfully converted via recovery workflows.
- Payment Failure Reasons: Categorized breakdown of card failures, network timeouts, authentication issues, and user cancellations.
- Daily Revenue Timeline: Chronological time-series of sales revenue and recovered amounts.
- Customer Response Breakdown: Distribution of customer recovery responses (Accepted, Promised, Opted Out, No Response).
GET /api/health- Server and database health check status.
POST /api/auth/register- Customer account registration.POST /api/auth/login- Customer account login.GET /api/auth/me- Retrieve current authenticated user profile.POST /api/auth/merchant/register- Submit merchant onboarding application.POST /api/auth/merchant/login- Merchant account login.POST /api/auth/admin/login- Administrator login.
GET /api/products- List products with category, search, price range, in-stock filter, sorting, and pagination.GET /api/products/categories- List active product categories.GET /api/products/:id- Retrieve single product details.
GET /api/carts- Retrieve active cart for current user.POST /api/carts- Create or retrieve cart.POST /api/carts/items- Add item to cart.PUT /api/carts/items/:id- Update cart item quantity.DELETE /api/carts/items/:id- Remove item from cart.POST /api/carts/apply-bundle- Apply promotional bundle discount.
GET /api/addresses- List customer saved addresses.POST /api/addresses- Add new delivery address.PUT /api/addresses/:id- Edit saved address.DELETE /api/addresses/:id- Remove saved address.PUT /api/addresses/:id/default- Set default delivery address.
GET /api/recommendations/product/:id- Get AI recommendations for product detail page.GET /api/recommendations/cart/:id- Get AI cross-sell recommendations for cart drawer.
POST /api/orders- Create order from cart items.GET /api/orders- List customer orders.GET /api/orders/:id- Retrieve order details and delivery timeline.POST /api/orders/:id/cancel- Request order cancellation before dispatch.POST /api/orders/:id/return- Request order return after delivery.
POST /api/payments/create- Create Razorpay order attempt.POST /api/payments/verify- Verify Razorpay payment HMAC signature.POST /api/payments/fail- Record payment failure details.
GET /api/recovery/cases- List recovery cases.GET /api/recovery/cases/:id- Get recovery case details.POST /api/recovery/cases/:id/send-email- Manually trigger recovery email.
GET /api/merchant/dashboard- Retrieve merchant dashboard KPIs.GET /api/merchant/analytics- Retrieve analytics metrics & timelines.GET /api/merchant/products- List seller catalog products.POST /api/merchant/products- Create new catalog product.PUT /api/merchant/products/:id- Update catalog product details.DELETE /api/merchant/products/:id- Archive seller product.PUT /api/merchant/products/:id/inventory- Adjust product inventory stock.GET /api/merchant/orders- List seller orders with status filters.PUT /api/merchant/orders/:id/status- Update order status / return logistics state.POST /api/merchant/upload-image- Upload product image asset.POST /api/merchant/helper/query- Send query to AI Merchant Helper.POST /api/merchant/helper/transcribe- Transcribe voice audio to text (Groq Whisper).POST /api/merchant/helper/tts- Synthesize text response to audio (Sarvam AI).
GET /api/admin/applications- List merchant onboarding applications.POST /api/admin/applications/:id/approve- Approve application & provision merchant.POST /api/admin/applications/:id/reject- Reject application with feedback.GET /api/admin/audit-logs- Retrieve system audit trail logs.
POST /api/webhooks/razorpay- Receive and process Razorpay webhooks.
RazorShop uses PostgreSQL configured via TypeORM.
erDiagram
Customer ||--o{ Cart : owns
Customer ||--o{ CustomerAddress : has
Customer ||--o{ Order : places
Merchant ||--o{ Product : owns
Merchant ||--o{ MerchantConfig : configures
Merchant ||--o{ MerchantApplication : submits
Product ||--|| Inventory : has
Cart ||--o{ CartItem : contains
Product ||--o{ CartItem : included_in
Order ||--o{ OrderItem : contains
Product ||--o{ OrderItem : included_in
Order ||--o{ OrderTimeline : tracks
Order ||--o{ Payment : has
Payment ||--o{ PaymentFailure : logs
PaymentFailure ||--o| RecoveryCase : triggers
RecoveryCase ||--o{ RecoveryAction : logs
users/customers: Store authentication credentials, names, emails, roles (customer,merchant,admin).merchants: Merchant profiles linked to user accounts.merchant_applications: Seller onboarding applications reviewed by admins.products: Catalog items with prices, categories, and deal statuses.inventory: Warehouse stock counts (quantity_on_hand,reserved).carts&cart_items: Active customer shopping carts.orders&order_items: Customer orders, line totals, and delivery statuses.order_timelines: Audit trail of order status transitions.customer_addresses: Saved delivery addresses.payments&payment_failures: Payment records and failure logs.recovery_cases&recovery_actions: Recovery pipeline cases and campaign logs.merchant_configs: Seller-defined recovery guardrails.
- Framework: React 18 + TypeScript + Vite
- Styling: Vanilla CSS tokens (
index.css) + TailwindCSS - Icons: Custom SVG component library (
Icons.tsx) - HTTP Client: Native
fetchAPI
- Runtime: Node.js 20 (ES Modules)
- Framework: Express.js
- ORM / Database Driver: TypeORM +
pg(PostgreSQL driver) - Authentication:
jsonwebtoken(JWT) +bcryptjs - Validation & Parsing: Custom middleware + TypeORM validation
- Groq API: Groq LLaMA 3 / Mixtral for recommendations, recovery emails, and Merchant Helper chat queries.
- Groq Whisper Large v3: Base64 audio speech-to-text transcription.
- Sarvam AI Bulbul v3: Text-to-speech audio synthesis (
speaker: shubh).
- Razorpay Node SDK & Razorpay Checkout JS: Order creation, HMAC-SHA256 signature verification, and webhook handling.
- Cloud Provider: Amazon Web Services (AWS)
- Compute: AWS EC2 Instance (Ubuntu 22.04 LTS)
- Database: AWS RDS PostgreSQL
- Process Manager: PM2
- Web Server / Reverse Proxy: Nginx (SSL/TLS via Certbot / Let's Encrypt)
- CI/CD Pipeline: GitHub Actions with AWS OIDC authentication & AWS SSM (Systems Manager) deployment execution script (
scripts/deploy-production.sh) - Local Dev Database: Docker & Docker Compose (
postgres:16-alpine)
RazorShop/
├── .github/
│ └── workflows/
│ └── ci-cd.yml # GitHub Actions CI/CD workflow definition
├── docs/
│ ├── architecture.md # System deployment topology and architecture guide
│ └── cicd.md # Production CI/CD pipeline, SSM, and rollback guide
├── packages/
│ ├── backend/ # Node.js / Express API application
│ │ ├── src/
│ │ │ ├── config/ # Database, environment, and app configuration
│ │ │ ├── middleware/ # Auth, error handling, and logger middleware
│ │ │ ├── migrations/ # TypeORM database migration files
│ │ │ ├── models/ # TypeORM database entities
│ │ │ ├── routes/ # Express API route definitions
│ │ │ ├── services/ # Core business logic services
│ │ │ ├── app.ts # Express application factory
│ │ │ ├── index.ts # Server entry point
│ │ │ └── seed.ts # Database seeding script
│ │ └── package.json
│ ├── frontend/ # React / Vite SPA application
│ │ ├── src/
│ │ │ ├── components/ # UI components (Storefront, Portals, Modals)
│ │ │ │ ├── analytics/ # Analytics charts & breakdown widgets
│ │ │ │ ├── common/ # Shared UI elements (Address modals, Icons, Popover)
│ │ │ │ ├── info/ # Static policy & status pages
│ │ │ │ └── merchant/ # Merchant catalog, inventory, order, helper views
│ │ │ ├── config/ # API configuration
│ │ │ ├── services/ # Auth & Address frontend services
│ │ │ ├── App.tsx # Main Application component & router
│ │ │ ├── index.css # Design system CSS variables & tokens
│ │ │ └── main.tsx # React application root entry
│ │ └── package.json
│ └── shared/ # Shared TypeScript DTOs & API contract interfaces
│ └── src/
│ └── types/
│ └── index.ts # DTOs, interfaces, and status types
├── scripts/
│ └── deploy-production.sh # Production deployment & automated rollback script
├── .env.example # Template environment variables
├── docker-compose.yml # Local PostgreSQL Docker configuration
├── package.json # Workspace root npm package configuration
└── README.md # Project documentation
Copy .env.example to .env in the root directory before running the application:
# Server Configuration
NODE_ENV=development
PORT=3000
FRONTEND_URL=http://localhost:5173
# Database Connection (PostgreSQL)
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/razor
# Razorpay Payment Gateway (Test Credentials)
RAZORPAY_KEY_ID=rzp_test_your_key_id
RAZORPAY_KEY_SECRET=your_key_secret
RAZORPAY_WEBHOOK_SECRET=your_webhook_secret
# Groq AI API
GROQ_API_KEY=your_groq_api_key
AI_MODE=mock # 'mock' for local development without API keys, 'live' for real Groq API calls
# Authentication
JWT_SECRET=your_jwt_secret
# Email Service (Resend)
EMAIL_DELIVERY_MODE=mock # 'mock' suppresses external network calls, 'live' uses Resend API
RESEND_API_KEY=your_resend_api_key
RESEND_FROM_EMAIL=nemat@razorshop.app
# Background Scheduler Control
SCHEDULER_ENABLED=false # Set to 'true' in production or background processing test environmentsSecurity Note: Never commit actual secret keys or credentials to repository tracking. Always manage production environment secrets securely on AWS server instances or GitHub Environment Secrets.
- Node.js: v20.x or higher
- npm: v10.x or higher
- Docker & Docker Compose (Optional, for running local PostgreSQL)
-
Clone the repository:
git clone https://github.com/NematSachdeva/RazorShop.git cd RazorShop -
Install workspace dependencies:
npm install
-
Configure Environment Variables:
cp .env.example .env
-
Start Local PostgreSQL Database:
docker-compose up -d
-
Execute Database Migrations & Seed Data:
# Run TypeORM schema migrations npm run db:migrate # Seed database with demo products, merchants, and categories npm run db:seed
-
Start Development Application:
npm run dev
- Frontend URL:
http://localhost:5173 - Backend API URL:
http://localhost:3000/api
- Frontend URL:
# Typecheck backend & frontend packages
npm run typecheck
# Build production workspace bundles (shared -> backend -> frontend)
npm run build
# Reset local database
npm run db:resetTo run the production backend server locally:
cd packages/backend
npm run startRazorShop includes unit, integration, and flow regression test suites in packages/backend/src:
# Execute backend test suite
npm run test --workspace=packages/backend
# Execute isolated unit tests (bypassing pre-migration hooks)
npm run test:unit --workspace=packages/backendThe test suites validate:
- Authentication & JWT token security
- Catalog search, category filtering, and AI recommendations
- Cart items, bundle calculations, and inventory reservations
- Order creation, Razorpay checkout verification, and payment failures
- Cancellation workflows & 5-stage return logistics
- Merchant onboarding application lifecycle
- Merchant Helper AI query parsing, transcription fallback, and TTS formatting
RazorShop is deployed in production on Amazon Web Services (AWS) at https://razorshop.app.
- AWS EC2: Hosted on an Ubuntu 22.04 LTS EC2 instance.
- AWS RDS: Production database managed on AWS RDS PostgreSQL.
- Nginx Reverse Proxy: Listens on port 443 with SSL/TLS termination via Certbot/Let's Encrypt. Serves static frontend assets from
/var/www/razorshopand proxies/api/*requests to port7070. - PM2 Daemon: Manages the Node.js Express backend process (
razor-backend) on internal port7070with automatic restarts and log rotation.
- GitHub Actions CI: On push to
master, GitHub Actions validates backend/frontend typechecking, executes unit tests, builds production bundles, and verifies zero hardcoded local endpoints (localhost:3000,127.0.0.1:7070) indist/. - AWS OIDC Authentication: Authenticates securely with AWS using OpenID Connect (
aws-actions/configure-aws-credentials@v4) without static AWS access keys. - AWS Systems Manager (SSM): Triggers deployment script
scripts/deploy-production.shremotely on the target EC2 instance. - Production Script Execution:
- Fetches target commit cleanly.
- Preserves EC2 instance
/home/ubuntu/razor/.envfile. - Executes database migrations against AWS RDS (
npm run db:migrate). - Syncs static frontend assets to
/var/www/razorshop. - Restarts
razor-backendunder PM2. - Conducts health checks against local (
http://127.0.0.1:7070/health) and public (https://razorshop.app/api/health) endpoints.
- Automated Rollback: If asset compilation, PM2 restart, or health verification fails,
deploy-production.shautomatically restores code to the previous Git commit (PREV_COMMIT), rebuilds assets, restarts PM2, and reports failure to GitHub Actions.
- OIDC Authentication for CI/CD: GitHub Actions deployment authenticates via AWS IAM OIDC roles, eliminating hardcoded long-lived cloud credentials.
- JWT Authentication & RBAC: API endpoints enforce role checks (
customer,merchant,admin), preventing unauthorized access to seller or administrator routes. - HMAC Signature Verification: Razorpay payment completions and webhooks are validated using HMAC-SHA256 signatures (
RAZORPAY_KEY_SECRETandRAZORPAY_WEBHOOK_SECRET) to prevent payment spoofing. - Password Hashing: Passwords encrypted using
bcryptjswith salt factor of 10. - Raw Body Webhook Parsing: Express captures raw unparsed buffers for Razorpay webhooks to guarantee cryptographically accurate HMAC verification.
- Environment Secret Isolation: Production database credentials and secret keys are stored exclusively in
/home/ubuntu/razor/.envon the EC2 instance.
- Global Express Error Middleware: Centralized error handler returning structured JSON error objects with appropriate HTTP status codes.
- Database Transaction Safety: TypeORM query runner transactions ensure atomic updates during checkout, inventory reservation, order cancellations, and refunds.
- AI Fallback & Mock Modes: Supports
AI_MODE=mockandEMAIL_DELIVERY_MODE=mockfor testing environments without external network dependencies. - Automated Deployment Rollback: Server-side deployment scripts automatically roll back application code and restart PM2 processes if deployment health checks fail.
- Dual Theme Support: Full Light Mode and Dark Mode support implemented across Customer, Merchant, and Admin Portals using unified CSS variable tokens (
var(--c-surface),var(--c-bg),var(--c-text),var(--c-gold),var(--c-border)). - Responsive Layout: Designed for mobile, tablet, and desktop viewports with responsive navigation headers, sliding drawers, and fluid product grids.
- Micro-Animations: Smooth CSS keyframe transitions (
animate-fadeIn,animate-fadeUp,animate-scrollBounce), scroll-reveal observers (.reveal.in-view), and interactive hover states.
Browse Catalog ──► Select Product ──► Add to Cart / View Bundle ──► Select Shipping Address ──► Checkout & Pay via Razorpay ──► Order Confirmation ──► Track Delivery Timeline ──► Submit Review / Request Return
Login / Register Application ──► Admin Approval ──► Access Merchant Dashboard ──► Manage Products & Stock ──► Fulfill Orders (Dispatch/Ship/Deliver) ──► Process Return Logistics & Refunds ──► Inspect Recovery Cases ──► Use AI Merchant Helper
Login to Admin Portal ──► View Pending Merchant Applications ──► Inspect Business Application Metadata ──► Approve / Reject Application ──► Review Audit Trail Logs
This project is proprietary and maintained for RazorShop. All rights reserved.