ADR-00008 — Polyglot Persistence: MongoDB for Product-Catalog, PostgreSQL for Inventory-Service

By Engineering Team•September 27, 2026•4 min read
  • Status: Approved / Implemented
  • Date: 2026-09-27
  • Authors: Engineering Team

Context

ADR-00005 already establishes that product-catalog and inventory-service each own their own data store rather than sharing one (its Option 3). What that ADR doesn’t explain is why the two stores are different technologies — product-catalog on MongoDB, inventory-service on PostgreSQL — rather than both services simply picking the same one, since both are Go services in the same admin-wizard flow. This ADR documents that choice.


Decision Drivers (FRs & NFRs)

See SR-004 for the full requirement list.

  • FR-02 (Draft Persistence): product-catalog’s product document holds descriptive fields that vary in shape by category and evolve over time (name, description, category, tags, image references) — a variable, evolving shape, not a fixed relational one.
  • FR-04 (Stock Threshold Entry): inventory-service must reject a submission where safety stock exceeds maximum capacity for any SKU × warehouse cell — a cross-row invariant best enforced with real transactional guarantees, not app-layer-only checks.
  • FR-06 (Compliance & Pricing): every active SKU must have valid pricing/tax/returns data before publish — a correctness-critical, money-adjacent invariant.
  • BR-04 / BR-05 (see BRD-004): stock-threshold and pricing/compliance data must be dependable enough to drive purchasing and sale decisions.

Options Evaluated

Option 1 — Polyglot: MongoDB for product-catalog, PostgreSQL for inventory-service (CHOSEN)

Each service picks the data-store technology that matches its own data shape and consistency need, independent of what the other service picks.

  • Pros:
    • product-catalog’s descriptive/merchandising data varies by category and evolves without a fixed relational shape (specs, tags, image references, category-specific attributes) — MongoDB’s document model holds this natively, without a migration every time a new descriptive attribute is introduced.
    • inventory-service’s SKU-transactional data (stock thresholds, pricing, package mapping) is correctness-critical and benefits from real ACID transactions and relational constraints — the safety-stock-vs-max-capacity rule (FR-04) and the “every active SKU needs compliance/pricing” rule (FR-06) are the kind of invariant a relational store can help enforce structurally, not just re-check in application code on every write.
    • Matches this monorepo’s template selection matrix (@templates/go-mongo-microservice vs @templates/go-postgres-microservice) — the choice is made once per service based on its actual data shape, not imposed platform-wide.
  • Cons & Accepted Trade-offs:
    • Two different database technologies to operate, monitor, and tune (separate connection-pool metric families — Mongo vs db.pgxpool.*, see the platform’s performance & metrics standards) instead of one.
    • No cross-store transaction is possible between the two services’ data — already an accepted constraint independent of this decision, since ADR-00005 already rejected synchronous coupling between them for other reasons.

Option 2 — Both services on MongoDB

Standardize inventory-service onto the same document store product-catalog uses.

  • Pros:
    • One less database technology to operate across the two services.
    • Consistent tooling/query language for any engineer who touches both services.
  • Cons (Why Rejected):
    • inventory-service’s stock-threshold and compliance/pricing invariants (FR-04, FR-06) would have to be enforced entirely in application code, with no native multi-document transactional guarantee at the same strength as a relational constraint or foreign key — a real money/stock-correctness need shouldn’t rest solely on app-level validation succeeding every time.

Option 3 — Both services on PostgreSQL

Standardize product-catalog onto the same relational store inventory-service uses.

  • Pros:
    • One less database technology to operate.
    • Strong consistency guarantees available everywhere, not just in inventory-service.
  • Cons (Why Rejected):
    • product-catalog’s descriptive schema varies per category/tenant and evolves over time — a rigid relational schema would need frequent migrations, or a sprawling attribute-table (EAV-style) schema, just to represent what MongoDB’s document model already holds natively (FR-02).

Final Decision

Option 1 is selected. Each service’s data-store technology matches its own actual data shape and consistency requirement — product-catalog’s variable descriptive data fits a document model, inventory-service’s correctness-critical transactional data fits a relational model with real ACID guarantees. Forcing both onto one technology would have made one of the two services fight its own data shape.