Multi-tenant ecommerce platform

Ecommerce Shoppee

20+ MicroservicesMulti-Tenant SaaSPCI-DSS & PII Compliant

ecommerce-shoppee is a multi-tenant ecommerce platform made up of more than twenty independently deployable services across Go, Rust and Node. Tenants sell products; customers search, cart, order, pay, ship, and return.

This section is the reference documentation for how the platform is actually built — the architectural decisions, trade-offs, and the occasional debugging war story that don’t fit neatly into a pull request description. It’s organized the way the codebase itself is organized: by architecture, by service, by security boundary, and by the cross-cutting concerns (observability, multi-tenancy) that every service has to get right.

System Architecture at a Glance

Ecommerce Shoppee — high-level microservice architecture: client apps, gateway, backend services, data stores, async messaging, and third-party integrations

Twenty-plus independently deployable services in Go, Rust, and Node, tied together by REST, gRPC, GraphQL, and Pub/Sub, behind a single CDN edge and Nginx gateway. The full inventory — every microservice, shared library, client app, platform tool, and communication pattern, each in one responsibility statement — lives in Architecture at a Glance. Request/response sequencing for a specific feature lives in that feature’s own doc under 04-architecture, driven by its BRD/SR — this page is the entry point, not the flow.

Composed of
order-servicetenant-serviceshop-servicesearch-serviceproduct-cataloginventory-servicecontent-processoruser-preference-serviceshipment-servicedocument-servicemedia-access-servicenotification-servicepii-servicepci-servicepayment-serviceprovider-auth-serviceuser-secure-enginetenant-migrationtenant-migration-orchestratorfirebase-functiongo-lang-core-librust-lang-core-libnode-lang-core-libui-applicationui-admin-application

All Docs

Showing every doc across all sections.

Architecture Decisions
Oct 11, 2026•4 min read

ADR-00047 — Order Query and Tracking Channel Strategy for My Orders

Why My Orders is served through shop-service's GraphQL orchestration rather than direct Flutter-to-order-service gRPC, why Track Shipment opens its own shipment-service SSE stream rather than reusing checkout's saga-progress stream, and why both stay on an always-fresh fetch policy instead of checkout's cached-snapshot pattern.

Architecture Decisions
Oct 11, 2026•6 min read

ADR-00044 — REST API Dispatch and Tiered Concurrency Over Direct Database Writes for Migration Delivery

Why tenant-migration-orchestrator delivers every migrated record through its target microservice's own REST API instead of writing directly into that microservice's database, and why downstream load is bounded by per-tier Pub/Sub concurrency caps rather than an unbounded or single-knob worker.

Implementer References
Oct 11, 2026•2 min read

Shiprocket Integration — Implementer Reference

Endpoint-level reference for shipment-service's Shiprocket integration: the serviceability tier-selection algorithm and caching strategy, request/response payloads for the five-step fulfillment sequence, the real tracking-webhook payload and the two bugs it exposed, and mock-service's local webhook simulator — a companion to the BRD/SR/ADR/Architecture/Technical-Debt set, not a replacement for it.

Technical Debt
Oct 11, 2026•5 min read

Technical Debt — Tenant Catalog Bulk Migration Gaps

Confirmed gaps surfaced while documenting the tenant catalog bulk migration pipeline: stale module docs claiming PRODUCT has no verify-time processor, no compatibility shim for the pipeline's earlier compiled-output format, both migration services missing from local docker-compose, the orchestrator's missing health endpoint and port mismatch, no /tmp payload-cache cleanup, and stale e2e/architecture-spec docs referencing a removed upload endpoint.

System Requirements
Oct 10, 2026•6 min read

SR-028 — Recently Viewed Products: System Requirements

Functional and non-functional requirements for the recently-viewed-products feature: product-catalog's fire-and-forget Pub/Sub publish on full-detail load, user-preference-service's capped, de-duplicated Mongo history and recency-ordered gRPC read, and shop-service's driving-id-list join powering both the storefront teaser and the full browsable page in ui-application.

Architecture Decisions
Oct 10, 2026•6 min read

ADR-00041 — Mobile Login & Signup: Phone-OTP, Dual-Path Initialization, and Consent Design

Why user-secure-engine owns a custom server-side OTP mechanism — shared across phone and email — instead of Firebase-native phone auth and Firebase-native email verification links, why signup/login get separate send/verify endpoint pairs, why account initialization runs on two deliberately redundant paths wired through a synchronous gRPC call, why PII+identity creation is a compensating saga rather than a distributed transaction, and why consent is a single checkbox over two independently versioned documents.

Services
Oct 10, 2026•6 min read

user-secure-engine — Identity, OTP, and Firebase Token Exchange

Rust dual-database (Postgres + MongoDB) microservice verifying Firebase ID tokens and App Check for the gateway, issuing custom 6-digit OTPs for signup/password-reset/phone-login and the decoupled profile phone/email change flow, owning the core user identity row and one-shot Terms/Privacy consent, and consuming the customer-avatar Pub/Sub pipeline.

Technical Debt
Oct 10, 2026•5 min read

Technical Debt — Customer Settings Gaps

Known gaps in the Flutter Settings feature and its backing services: no re-acceptance flow when a legal policy version changes, non-actionable support contact details, no-op complaint/export/deletion requests, an always-empty payment transactions list, India-only client-only postal-code validation, pre-existing addresses missing name/phone fields, and a stale API table in user-secure-engine's own CLAUDE.md.

Architecture
Oct 10, 2026•6 min read

Architecture — Customer Settings: Component Topology and Data Flow

Component topology and end-to-end data flow for the Flutter Settings feature: preference updates through user-preference-service, address/payment-reference hydration through pii-service/pci-service, identity and OTP-commit contact changes and one-shot legal consent through user-secure-engine, avatar processing through media-access-service/content-processor, and tenant-info aggregation through tenant-service.

System Requirements
Oct 10, 2026•6 min read

SR-027 — Mobile Login & Signup: System Requirements

Functional and non-functional requirements for phone-OTP-first account creation and login in the Flutter app: user-secure-engine's unauthenticated send/verify endpoint pairs, Firebase custom-token minting, the dual synchronous + onCreate-trigger account-initialization saga, single-checkbox Terms/Privacy consent capture with per-document version tracking, and the gateway's App-Check-only enforcement path for pre-auth routes.

System Requirements
Oct 10, 2026•6 min read

SR-026 — Customer Settings: System Requirements

Functional and non-functional requirements for the Flutter Settings feature area: identity/profile management through user-secure-engine, decoupled OTP-commit phone/email changes, one-shot Terms/Privacy consent, region/fashion/notification preferences and saved addresses/payment-method references through user-preference-service, and tenant-info-sourced support/legal/about content.

Business Requirements
Oct 10, 2026•4 min read

BRD-025 — Customer Settings: Identity, Preferences, and Account Management

Business requirements for giving a shopper a single, self-service place to manage who they are, how they shop, and how the business reaches them — identity and contact verification, region and delivery preferences, an optional fashion profile, notification choices, saved addresses, saved payment methods, support access, legal document review, and account exit paths.

Services
Oct 9, 2026•5 min read

Tenant-Service — Tenant Identity & Master Configuration

Go microservice owning tenant identity and the 7-step Tenant Master configuration wizard — store identity, theme/branding (with an async logo pipeline), contact/support, registered address, and the three legal policy documents — plus the aggregated client-facing tenant-info/public-policies read path and a read-only gRPC tenant-code lookup consumed by order-service.

System Requirements
Oct 9, 2026•7 min read

SR-025 — Tenant Master: Configuration Wizard System Requirements

Functional and non-functional requirements for tenant-service's 7-step tenant configuration wizard: the independently-saved Basic/Theme/Contact/Address/Terms/Privacy/Returns sections, the logo upload pipeline, the policy-type discriminator and auto-versioning, and the downstream aggregated tenant-info/public-policies read path.

Services
Sep 25, 2026•6 min read

Inventory-Service — SKU Variants, Stock, Pricing & Package Data

Go microservice owning every SKU-transactional concern of a product — variant definition, stock thresholds, volumetric specs, compliance/pricing, package mapping, order-driven stock reservation/consumption, the admin Stock Entry movement-recording/approval ledger, and the Warehouse Master / Package Master admin master-data consoles — publishing five step-completion events product-catalog's publish-readiness gate depends on, plus two dedicated search-only sync topics for search-service.

Business Requirements
Oct 9, 2026•4 min read

BRD-022 — Package Master: Maintaining the Catalog of Shippable Container Types

Business requirements for letting operations staff define and retire the standard box/packaging types products are shipped in — each one carrying the external and internal dimensions and weight limits needed to choose a container and calculate shipping cost — without an incomplete packaging type ever being assigned to a live product.

Business Requirements
Oct 8, 2026•5 min read

BRD-018 — Concurrent Demand: Stock Integrity Under Simultaneous Orders and the Scaling Decision

Business requirements for what must hold when many customers chase the same limited stock at the same moment: exactly one of them wins, everyone else is told clearly and quickly that they lost, checkout itself stays fast regardless of how many people are trying, and the business can deliberately choose when to invest in handling a demand spike faster rather than discovering the limit during one.

System Requirements
Oct 8, 2026•7 min read

SR-019 — Concurrent Demand: Stock Integrity Under Simultaneous Orders System Requirements

Functional and non-functional requirements for inventory-service's StockBalanceService: a conditional-update guard that makes reservation safe under concurrent orders without a database lock, an upsert-based row lock with deterministic SKU ordering that makes consumption safe without deadlocks, and the append-only reservation-guard table that makes both steps idempotent under saga retries. The Redis/token-bucket layer for a much larger demand spike is a named gap, not a built requirement.

Architecture
Oct 8, 2026•6 min read

Architecture — Inventory Stock Reservation, Consumption, and Concurrency Control

Component topology and end-to-end data flow inside inventory-service's StockBalanceService: the non-blocking conditional-update guard that reserves stock, the upsert-acquired row lock with deterministic SKU ordering that consumes it, and the append-only guard-row table that makes both steps idempotent under saga retries — the internals behind the reservation/consumption steps the checkout saga treats as a black box.

Technical Debt
Oct 9, 2026•3 min read

Technical Debt — Order Inventory Reservation History Has No Query Surface

order_inventory_reservations already records a complete, append-only history of every reservation line's lifecycle, but inventory-service exposes no repository method, service method, or endpoint that reads that history back out — reconstructing what happened to a specific order's reservation requires direct database access today.

System Requirements
Oct 8, 2026•8 min read

SR-021 — Warehouse Stock Entry Administration Console System Requirements

Functional and non-functional requirements for ui-admin-application's stockEntry feature: a 3-step wizard (Transaction Info, Variant Matrix Entry, Review & Post) sharing one review screen between new-submission and existing-pending-approval states, a client-computed before/after stock preview, and a filterable movement list — all sourced from the real React/TypeScript source, not the feature's own CLAUDE.md narrative.

Business Requirements
Oct 8, 2026•4 min read

BRD-020 — Warehouse Stock Entry: Administration Console

Business requirements for the staff-facing console operations and supervisors actually use to record, self-check, review, and approve or decline a warehouse stock movement — guided entry by movement type, a visual quantity grid per product, a live before/after preview, one shared review summary for both submission and approval, and a searchable movement history.

Architecture
Oct 8, 2026•7 min read

Architecture — Warehouse Stock Entry: Creation, Approval-Gated Balance Mutation, and Immutable Ledger

Component topology and end-to-end data flow inside inventory-service's admin Stock Entry feature: recording a movement with zero immediate balance effect, approving it to transactionally mutate the balance and write an immutable ledger entry, rejecting it as a pure status flip, cloning a prior movement, and the opening-entry initialization guard — the admin-side counterpart to the checkout-driven reservation/consumption flow.

Technical Debt
Oct 8, 2026•5 min read

Technical Debt — Warehouse Stock Entry Gaps

Three confirmed gaps in inventory-service's admin Stock Entry feature: the supervisor-review flag is stored but never enforced as an approval-role gate, cloning a movement never copies its source line items, and the opening-entry bulk-initialization endpoint's own doc-comment claims a gRPC/product-catalog-publish auto-trigger that doesn't exist anywhere in the codebase.

Architecture Decisions
Oct 8, 2026•7 min read

ADR-00036 — Deferred, Approval-Gated Balance Mutation and a Database-Enforced Immutable Ledger for Stock Entry

Why inventory-service's admin Stock Entry feature defers every balance mutation until explicit approval, rather than applying it immediately and reversing on rejection, and why ledger immutability is enforced with a PostgreSQL trigger rather than left as an application-only convention.

System Requirements
Oct 8, 2026•7 min read

SR-020 — Warehouse Stock Entry: Ledger & Approval Control System Requirements

Functional and non-functional requirements for inventory-service's admin Stock Entry feature: six operator-facing transaction modes with a per-mode sign contract, deferred balance mutation that only takes effect on explicit supervisor approval, a database-trigger-enforced immutable ledger, and the opening-entry guard that prevents a double-initialized SKU x warehouse pair. Three implementation gaps — unenforced approval RBAC, a Clone that drops line entries, and an unwired gRPC auto-trigger claim — are named gaps, not built requirements.

Business Requirements
Oct 8, 2026•4 min read

BRD-019 — Warehouse Stock Entry: Auditable Movement Recording & Approval Control

Business requirements for recording every warehouse stock movement — new stock in, returns, floor-count corrections, initial setup, loss, damage — as a permanent, unchangeable transaction with an accurate running balance per item, with a second person's approval required before certain movements take effect.

Technical Debt
Oct 8, 2026•4 min read

Technical Debt — High-Concurrency Stock Contention Scaling Gap

inventory-service has no in-memory, pre-database fast-reject layer for a much larger burst of simultaneous orders against the same SKU than ordinary contention — a scheduled flash-sale-scale event would hit PostgreSQL's own row-lock queuing and write contention directly, with no first-come-first-served fairness guarantee beyond whichever request the database happens to serialize first.

Architecture Decisions
Oct 8, 2026•8 min read

ADR-00035 — Conditional-Update Reservation vs. Row-Locked Consumption, and the Redis/Token-Bucket Scaling Decision

Why inventory-service deliberately uses two different concurrency-control mechanisms for the two halves of the reserve-then-consume flow — a non-blocking conditional UPDATE guard for reservation, and a pessimistic upsert-acquired row lock for consumption — rather than one uniform locking strategy for both, and why a Redis/token-bucket pre-reservation layer is deferred rather than built now.

Business Requirements
Oct 3, 2026•6 min read

BRD-013 — Checkout Completion: Real Payment Capture and Reliable Fulfillment Handoff

Business requirements for what must happen once a customer taps Place Order & Pay: stock must be set aside before it's sold again, the order must reliably reach a courier, stock is only permanently taken once that succeeds, nothing is left stuck if a step fails, what was ordered never silently changes, and the customer sees clear confirmation and live progress. Real payment collection and resolving a delayed or duplicate payment confirmation are covered separately in BRD-015.

System Requirements
Oct 3, 2026•6 min read

SR-014 — Checkout Completion: Payment Capture & Fulfillment Handoff System Requirements

Functional and non-functional requirements for order-service's Temporal checkout saga: scheduling the saga at order creation, saga-isolated progress tracking, real-time progress streaming, and the shipment handoff into shipment-service's existing fulfillment orchestration. Real payment-order creation, webhook capture, and the Razorpay integration are specified separately in SR-016.

Architecture
Oct 8, 2026•7 min read

Architecture-00014 — Checkout Saga Orchestration Pattern & Audit Trail

The saga-as-a-pattern mechanics — workflow, activities, compensation, signals, timeouts — behind order-service's checkout coordination; the order_orchestrations/SagaHistory and order_status audit/timeline collections; the SSE/Pub/Sub real-time progress channel; the cmd/api-vs-cmd/worker Temporal client/server split; and the end-to-end request flow across happy-path and failure scenarios.

System Requirements
Oct 8, 2026•6 min read

SR-018 — Dependable, Auditable Multi-Step Order Transaction Coordination: System Requirements

Functional and non-functional requirements for the coordination capability underneath order-service's checkout saga: a workflow engine supplying retry/timer/signal primitives as built-in guarantees, a single addressable coordinator per transaction, and an independently-queryable, append-only audit record — distinct from SR-014's checkout-specific sequencing requirements.

Business Requirements
Oct 8, 2026•5 min read

BRD-017 — Dependable, Auditable Coordination of Multi-Step Order Transactions

Business requirements for the mechanism that coordinates a placed order's multiple steps — stock, payment, fulfillment — as one dependable transaction: the coordination mechanism itself must be provably reliable, every order's full transaction history must be auditable end-to-end in one place, and the cost of building this reliability in-house must be weighed against adopting an established approach.

Technical Debt
Oct 2, 2026•4 min read

Technical Debt — Reusable Checkout Orchestration Gaps

Tracked, unresolved gaps in the shared product/checkout orchestration — a stale diagram label, a documentation/code TTL mismatch on the checkout-session cache, the unenforced schema contract between shop-service's and order-service's checkout-session structs, the client/server duplicated rounding formula for non-default delivery tiers, the no-freshness-recheck cached price summary at order creation, and inventory-service's flat per-SKU GST rate sourcing instead of a category/HSN-driven slab mapping.

Business Requirements
Oct 5, 2026•4 min read

BRD-015 — Payment Capture & Confirmation

Business requirements for real, verified payment collection once a customer taps Place Order & Pay: payment must be genuinely collected from the payment provider (not just recorded against a selected method), a delayed payment confirmation must still be resolved to a definite outcome, and a repeated confirmation must never be applied to an order twice.

Business Requirements
Oct 2, 2026•5 min read

BRD-011 — Reusable Product-to-Order Journey With Trustworthy Totals

Business requirements for a product-to-order journey — viewing a product, adding to cart or buying it directly, checking out, and placing the order — where every screen shows consistent pricing and delivery information, checkout always reflects the payment methods actually available for that order, and the amount charged always matches the amount the customer was shown.

System Requirements
Oct 3, 2026•5 min read

SR-015 — Checkout Review: Address, Delivery, and Payment Selection System Requirements

Functional and non-functional requirements for the Checkout screen's own behavior: the shared cart/Buy-Now screen, address-change re-querying, instant delivery-tier selection, live payment-method re-quote with rollback, the order-summary breakdown contract, and idempotent, double-submission-safe order placement.

Technical Debt
Oct 2, 2026•4 min read

Technical Debt — Multi-Courier Fulfillment Gaps

Tracked, unresolved gaps in shipment-service's Shiprocket integration — the single-instance in-memory SSE broker with no replay on scale-out, the absence of an automated non-delivery (NDR) workflow, the single fixed pickup-location assumption, manual mock/live routing, incomplete audit-trail PII masking for resolved addresses, and no query surface for per-order fulfillment status.

Technical Debt
Sep 27, 2026•3 min read

Technical Debt — Scalable Search Product Gaps

Tracked, unresolved gaps in the product search implementation — offset-based pagination at scale, no server-side cache on the search read path, an unverified shared-index scaling ceiling, a stale doc-vs-code mismatch in search-service's own documentation, a now-corrected SR-006 conflation of two distinct sync mechanisms, and inconsistent publish reliability across the four catalog-to-search sync streams.

Architecture Decisions
Sep 29, 2026•5 min read

ADR-00016 — Query-Time Computation vs. a Dedicated Recommendation Engine for Storefront Merchandising Sections

Architecture decision record for why shop-service's product-discovery sections are powered by direct MongoDB aggregation and PostgreSQL SQL computed at request time and joined in shop-service, rather than a dedicated recommendation/ranking engine — with a real recommendation engine explicitly deferred, not rejected, pending a shopper-behavior event pipeline.

System Requirements
Sep 29, 2026•7 min read

SR-009 — Local Development Environment Topology System Requirements

Functional and non-functional requirements for the platform's full local-development system topology — gateway/CDN split, client apps, REST/GraphQL/SSE/gRPC transport surfaces, data stores, async messaging, workflow orchestration, third-party provider integration, and the observability stack — as actually wired in docker-compose.yml and nginx.conf.

Architecture Decisions
Sep 27, 2026•6 min read

ADR-00010 — Polyglot Language & Runtime Selection: Go, Rust, Node, Flutter, React

Architecture decision record for why this platform deliberately does not standardize on one language — Go for domain/CRUD microservices and the Temporal workflow host, Rust for encryption- and auth-critical services, Node/NestJS for pipeline orchestration, Flutter for the customer mobile app, React for the admin console — instead of one language end to end. This is the umbrella 'why polyglot' record; each pairwise comparison has its own detailed ADR (00011–00015).

Architecture Decisions
Sep 27, 2026•5 min read

ADR-00009 — gRPC for Synchronous Inter-Service Calls, REST Only at Service Edges

Architecture decision record for why every synchronous service-to-service call in this platform uses gRPC rather than REST/JSON, while REST/GraphQL remain reserved for each service's own admin or client-facing edge — a cross-cutting decision that applies wherever two backend services talk to each other synchronously, not just product-catalog and inventory-service.

System Requirements
Sep 27, 2026•5 min read

SR-007 — Runtime & Client Framework Selection System Requirements

Functional and non-functional requirements mapping BRD-007's cost, startup-latency, data-protection, and platform-reach criteria to the concrete backend runtimes (Go, Rust, Node/NestJS) and client frameworks (Flutter, React) this platform actually uses, and to Java/Angular/React Native as the named alternatives evaluated against them.

Business Requirements
Sep 27, 2026•3 min read

BRD-007 — Runtime & Client Framework Selection

Business requirement for how backend runtimes and client application frameworks are chosen across this platform: minimizing infrastructure cost and startup latency under variable load, protecting sensitive customer and payment data, and reaching both mobile platforms and a management console with the smallest maintainable footprint.