PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-sonnet)
Token size
1,690
Example input
[current_system_description]: Monolithic Rails app handling users, orders, inventory, and reporting in one codebase and database [business_domain]: E-commerce: order management, inventory tracking, customer accounts, analytics reporting [team_structure]: 3 squads of 4 engineers each, currently all committing to the same repo [migration_constraints]: No planned downtime allowed, 9-month budget, must ship new features in parallel
Example output
# E-Commerce Monolith Decomposition Blueprint ## SECTION 1 — DECOMPOSITION READINESS GATE | Dimension | Assessment | Evidence Type | |-----------|------------|----------------| | Monolith coupling level | **High** — single codebase, single DB, no described module boundaries | STATED (single codebase/DB) / INFERRED (tangling) | | Team alignment with domains | **Misaligned** — 3 squads, all committing to the same repo, no domain ownership described | STATED (shared repo) / INFERRED (misalignment) | | Operational maturity | **Unknown, treat as Low** — no containers, CI/CD, or deploy pipeline mentioned | INFERRED (absence of evidence) | | Data sharing complexity | **Single shared DB** across users, orders, inventory, reporting | STATED | | Decomposition urgency | **Team velocity** — 12 engineers on one repo/deploy line, plus a hard mandate to ship features *and* migrate simultaneously | INFERRED | **READINESS VERDICT: READY, CONDITIONAL** — the four domain areas are cleanly nameable and the constraints (no downtime, 9 months, parallel feature work) are compatible with a strangler-fig approach, but operational maturity (CI/CD, feature flags, event infrastructure) must be verified/built in Phase 0 before any service cutover, or the "no downtime" constraint cannot actually be honored. **Failure mode priority map:** | Failure Mode | Priority | Evidence Type | Conf | |---|---|---|---| | Services split along technical layers, not domain boundaries | HIGH | INFERRED | 70 | | Distributed monolith: all services deploy together | HIGH | INFERRED | 75 | | Shared database across multiple services | HIGH | STATED (current) / INFERRED (risk of persisting) | 85 | | Over-decomposition: too many services for team size | MED | INFERRED | 60 | | No service contract ownership — backward compatibility breaks | HIGH | INFERRED | 65 | The two highest-confidence risks both trace to the same root cause: today, 3 squads share one repo and one DB with no visible ownership lines, so without deliberate intervention the "decomposition" could easily become 4 services that still deploy together and still write to the same tables. --- ## SECTION 2 — BOUNDED CONTEXT & DOMAIN MAP | Bounded Context | Core Domain? | Responsibility | Owns Data | Team Owner | Evidence Type | |---|---|---|---|---|---| | Order Management | YES (core) | Order lifecycle, checkout coordination, fulfillment triggers | orders, order_items, order_status | Squad A (INFERRED assignment) | STATED context / INFERRED detail | | Inventory Tracking | YES (core) | Stock levels, SKU management, reservation logic | inventory_items, stock_levels, warehouses | Squad B (INFERRED) | STATED context / INFERRED detail | | Customer Accounts | NO (supporting) | Registration, auth, profile, addresses | users, addresses, auth_credentials | Squad C (INFERRED) | STATED context / INFERRED detail | | Analytics Reporting | NO (generic/supporting) | Cross-domain aggregation, dashboards | read-only aggregated/denormalized store | Shared/rotating (INFERRED — see flag below) | STATED context / INFERRED detail | ⚠ **Team-to-context mismatch:** 4 bounded contexts, 3 squads. This is flagged again in Section 6 — someone must either co-own two contexts or the org needs to accept a non-1:1 Conway mapping for reporting. **Context relationships:** | Context A | Relationship Type | Context B | Integration Pattern | Evidence Type | |---|---|---|---|---| | Order Management | Customer/Supplier (Order depends on Inventory) | Inventory Tracking | API (sync stock check/reserve) + Event (stock reserved/released) | INFERRED | | Order Management | Conformist (Order consumes, doesn't own, customer data) | Customer Accounts | API call or event at order-time | INFERRED | | Analytics Reporting | Customer/Supplier (pure downstream consumer of all three) | Order / Inventory / Customer | Event-driven — published domain events feed a read model | INFERRED (high confidence — standard pattern for analytics extraction) | --- ## SECTION 3 — SERVICE BOUNDARY REGISTER | Service | Bounded Context | Cohesion Score | Coupling Risk | Data Ownership | API Surface | Team | Evidence Type | |---|---|---|---|---|---|---|---| | Order Service | Order Management | High | Medium (depends on Inventory + Customer) | orders, order_items | `POST /orders`, `GET /orders/:id`, `PATCH /orders/:id/status` | Squad A | INFERRED | | Inventory Service | Inventory Tracking | High | Medium (Order needs near-real-time stock) | inventory_items, stock_levels | `GET /inventory/:sku`, `POST /inventory/reserve`, `POST /inventory/release` | Squad B | INFERRED | | Customer Service | Customer Accounts | High | Low–Medium (widely referenced but self-contained) | users, addresses, auth | `GET /customers/:id`, `POST /auth/login` | Squad C | INFERRED | | Reporting Service | Analytics Reporting | Medium (aggregates across domains) | Low if event-driven / High if built on cross-DB queries | read-optimized event-sourced store | `GET /reports/sales`, `GET /reports/inventory-turnover` | Squad C (secondary duty) or rotating | INFERRED | **Assumption ledger:** | Assumption | Where It Enters | If False — Boundary Effect | |---|---|---| | Customer Accounts is a genuinely separate bounded context from Orders | Order/Customer boundary | Should merge into Order Service — would drop the count to 3 services, matching 3 squads exactly | | Reporting can tolerate eventual consistency, not real-time queries | Reporting Service design | Event-driven CQRS breaks; would need synchronous read replicas instead, and Reporting could no longer be the safe "extract first" candidate | | Inventory reservation does not need to be ACID-atomic with order creation | Order↔Inventory integration | If it must be atomic today, a saga/compensating-transaction pattern is required, raising Phase 3–4 risk from Medium to High | | Payments live inside Order Service (no distinct payment gateway complexity mentioned) | Order Service data ownership | If payments involve a third-party gateway or PCI scope, a separate Payment Service (or ACL) is needed and the Order boundary as drawn is wrong | | 3 squads can cover 4 target services with one squad double-owning Reporting | Team assignments (Section 2/3) | If untenable, either merge two contexts or add a 4th team — current structure doesn't cleanly cover 4 domains | **⚠ Silent corruption flags:** - Reporting almost certainly runs cross-table SQL joins today (typical for a Rails monolith's dashboards). Even after Order/Inventory/Customer are "split," if Reporting keeps querying the old shared tables directly, every other boundary is silently undone — the DB is still one shared surface. - If stock decrement and order creation currently happen inside the same DB transaction (common for preventing overselling), that atomicity guarantee disappears the moment Order and Inventory become separate services. This must be explicitly replaced with a saga, not assumed away. - Customer address data is likely duplicated today as a point-in-time snapshot on each order (shipping address at time of purchase) versus the live, editable profile. Treating "customer data" as one single entity to relocate — rather than two distinct concerns (current profile vs. historical snapshot) — is a common source of quiet data-ownership bugs. --- ## SECTION 4 — DATA OWNERSHIP & DECOMPOSITION PLAN | Current Shared Table/Entity | Target Owner Service | Migration Strategy | Cross-Service Query Solution | Evidence Type | |---|---|---|---|---| | users / auth tables | Customer Service | Strangler Fig — extract API layer first, migrate table last | Other services store customer_id reference; fetch via API or cache | INFERRED | | orders / order_items | Order Service | Strangler Fig + Branch by Abstraction on write paths | Inventory/Customer consume order events, not direct queries | INFERRED | | inventory_items / stock_levels | Inventory Service | Database-per-Service with dual-write during transition, then cutover | Order Service calls Inventory API synchronously for reservation; subscribes to stock-change events for local cache | INFERRED | | ad hoc reporting queries (joins across all tables) | Reporting Service | CQRS — new read-optimized store fed entirely by domain events | Event stream populates denormalized read models; no direct DB access to other services' tables | INFERRED | --- ## SECTION 5 — PHASED MIGRATION ROADMAP | Phase | Services Extracted | Strategy | Risk | Rollback Plan | Timeframe | Evidence Type | |---|---|---|---|---|---|---| | 1 — Strangler start | Reporting Service | Strangler Fig + event sourcing for read model | Low | Legacy in-monolith reports stay live; flip a feature flag back if new service diverges | Months 1–2 | INFERRED | | 2 | Customer Service | Branch by Abstraction (internal API facade first, then swap implementation) | Medium | Abstraction layer falls back to monolith DB if new service misbehaves | Months 3–5 | INFERRED | | 3 | Inventory Service | Database-per-Service with dual-write + reconciliation job | High (stock accuracy is business-critical) | Dual-write lets monolith remain source of truth until reconciliation is clean | Months 5–7 | INFERRED | | Steady state — Phase 4 | Order Service | Strangler Fig on write path (last, since it depends on Inventory/Customer being stable) | High (checkout is revenue-critical) | Shadow-write to monolith order path in parallel until new service is proven at full load | Months 7–9 | INFERRED | **Phase 1 implementation brief:** Stand up the Reporting Service with its own datastore and add lightweight domain-event publishing (`order_placed`, `inventory_adjusted`, `customer_updated`) directly from existing monolith code paths, without touching any write behavior. Route these events into the new service to build a denormalized read model while the monolith's existing reporting controllers keep serving live traffic untouched. Run the new service in shadow mode for 2–4 weeks, comparing its output against the legacy reports for correctness, then cut the reporting UI/API over behind a feature flag. Because no write path is modified in this phase, downtime risk is effectively zero and rollback is an instant flag flip. **Input robustness — where the plan breaks:** | Condition | Effect | Mitigation | |---|---|---| | Team loses a key engineer mid-migration | Squads are only 4 people each — losing one concentrates risk and stalls whichever phase they own | Pair on every extraction, keep written runbooks per phase, avoid single-owner migration steps | | Timeline compressed by 50% (~4.5 months) | Only 1–2 phases are safely achievable; Inventory and Order (the highest-risk phases) are the ones most likely to get rushed | Re-scope to Reporting + Customer only; explicitly defer Inventory/Order to a funded second phase rather than compressing checkout migration | | Shared DB cannot be split (legacy constraint) | True database-per-service is blocked indefinitely; services stay coupled at the data layer | Fall back to schema-per-service within the same physical instance, with DB-permission-enforced "no cross-schema joins" as an interim discipline | --- ## SECTION 6 — BLUEPRINT INTEGRITY CHECK | Check | Status | Note | |---|---|---| | Every service maps to exactly one bounded context | ✅ | | | No two services own the same data entity | ✅ | Caveat: address snapshot-vs-profile distinction must be resolved explicitly (see silent corruption flags) | | Team-to-service ratio is reasonable | ⚠ | 4 services, 3 squads — requires either co-ownership of Reporting or a structural change | | Migration starts with the lowest-coupling service | ✅ | Reporting first | | Every shared table has a migration strategy | ✅ | | | All INFERRED findings are labeled | ✅ | | **DECOMPOSITION CONFIDENCE: 68/100** — the four domain areas are clearly nameable from the stated inputs, but several load-bearing operational facts (transaction semantics, payment handling, deploy infrastructure) are unstated and had to be inferred. **Biggest unknown:** whether order creation and inventory decrement currently share a single DB transaction. This one fact determines whether the Order↔Inventory split needs a full saga/compensating-transaction pattern (high complexity, longer timeline) or can tolerate simple eventual consistency — it would reshape the entire risk profile of Phases 3–4. **STATED vs. VERIFY breakdown:** *STATED:* Rails monolith; single codebase and database; handles users, orders, inventory, reporting; e-commerce domain covering order management, inventory tracking, customer accounts, analytics reporting; 3 squads of 4 engineers, currently all committing to the same repo; zero planned downtime; 9-month budget; must ship new features in parallel with migration. *VERIFY before implementation:* whether orders and inventory share a DB transaction; whether payments are embedded in Order data or a distinct system (PCI scope?); any informal squad-to-domain familiarity that should inform team assignment; current CI/CD and feature-flag infrastructure maturity; whether reporting can tolerate eventual consistency; any compliance requirements affecting customer data handling.
Claude

Microservices Decomposition Planner

Add to Cart
PromptBase Select
Get this prompt + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View Select
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-SONNET
Tested icon
Guide icon
4 examples icon
Free credits icon
🧩Before you split your monolith, find out if you should. Assesses decomposition readiness (coupling level, team-domain alignment, operational maturity) and delivers a clear READY/PREMATURE verdict — then, if ready, produces a full decomposition blueprint with cohesion scores, coupling risk ratings, and failure-mode checks for distributed-monolith traps, shared databases, and over-decomposition. Domain-driven design + Conway's Law analysis built in. STATED/INFERRED throughout.🕸️
...more
Added over 1 month ago
Report
Browse Marketplace