Skip to main content

ChatGPT Prompt for a Microservices Design Pattern Advisor

Get opinionated microservices guidance on service boundaries, communication patterns, data consistency, and anti-pattern detection.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
I am building a e-commerce platform using microservices architecture.

Current state: monolith being decomposed into microservices
Services: User, Product Catalog, Order, Payment, Notification, Inventory
Communication: mostly REST, some RabbitMQ
Data stores: shared PostgreSQL (migrating to per-service), Redis, Elasticsearch
Pain points: data consistency across order and inventory, cascading failures, slow deployments

Advise on:
1. **Service Boundaries** — are my services properly decomposed? Apply Domain-Driven Design (bounded contexts) principles
2. **Communication Patterns** — sync vs async for each interaction, recommend:
   - API Gateway pattern implementation
   - Event-driven patterns (saga, event sourcing, CQRS) where appropriate
   - Circuit breaker and retry policies
3. **Data Consistency** — strategy for cross-service data:
   - Distributed transaction approach
   - Eventual consistency patterns
   - Handling duplicate events (idempotency)
4. **Anti-Patterns Check** — identify if I have:
   - Distributed monolith symptoms
   - Chatty services
   - God services
   - Shared databases
5. **Observability** — distributed tracing, centralized logging, health checks
6. **Deployment** — independent deployability, backward compatibility
7. **Architecture Diagram** — describe the recommended target architecture

Be opinionated — tell me what is wrong, not just what could be better.

What this prompt does

This prompt forces ChatGPT into an architecture review mode rather than a generic explanation mode. By requiring you to state your current services, communication method, data stores, and pain points upfront, it eliminates the vague "it depends" response and produces targeted recommendations against your actual system. The "be opinionated" instruction at the end is load-bearing — without it, models hedge. With it, you get direct verdicts: your service is a god service, your database is shared incorrectly, your sync calls should be async.

The decomposition strategy variable ([decomposition_strategy]) is what separates this from a generic microservices Q&A. Plugging in "Domain-Driven Design bounded contexts" gets you different boundary recommendations than "team ownership" or "strangler fig migration" — and all three are valid depending on where you are in your migration.

The seven-section structure mirrors how a real distributed systems review works: boundaries first, then communication contracts, then data consistency (the hardest part), then anti-pattern detection, then cross-cutting concerns. You get a complete picture, not just the section you thought to ask about.

When to use it

  • You are decomposing a Laravel or Rails monolith and are not sure where to cut service boundaries.
  • You have services that constantly call each other synchronously and suspect you have a distributed monolith.
  • You are designing a new event-driven system and need to choose between saga choreography and orchestration.
  • You inherited an existing microservices setup and need a structured audit before adding more services.
  • You are preparing for a technical design review or architecture decision record (ADR) and want a second opinion.
  • You are onboarding a new team member and want a clear description of the target architecture.

Example output

Service Boundaries:
  OrderService (✓) — clean, owns order lifecycle
  InventoryService (✗) — god service: also handles pricing and promotions, split required
  NotificationService (✓) — single responsibility

Communication:
  Order → Inventory (stock check): currently sync REST → convert to async event
  Reason: inventory check on checkout creates coupling; use reserved-stock event pattern

Data Consistency:
  Cross-service order+inventory: use choreography-based saga
  Compensating transaction: release reserved stock on payment failure event

Anti-Patterns Detected:
  - Shared `products` table accessed by 3 services — critical, breaks independent deployability
  - OrderService calls InventoryService calls PricingService in chain — chatty, 3-hop latency

Architecture Diagram:
  API Gateway → OrderService (owns DB: orders)
                     ↓ publishes: OrderPlaced event
             InventoryService (owns DB: inventory) ← subscribes
             PricingService (owns DB: pricing)     ← subscribes
  Async bus: RabbitMQ / topic-per-domain
  Sync only at edge: gateway → OrderService for checkout initiation

Pro tips

  • Set [decomposition_strategy] to match your team structure. Conway's Law is real — if two teams own one service, it will fragment. If one team owns five services, they will drift back toward a monolith.
  • For [pain_points], be specific about failure modes, not symptoms. "Deployments break other services" is more actionable than "things are slow."
  • Run this prompt twice: once for your current state, once for your 12-month target state. Diff the outputs to build a migration roadmap.
  • The circuit breaker recommendation will be generic unless you name your stack in [system_type]. Specifying "Node.js with Axios and RabbitMQ" gets you library-specific guidance rather than conceptual descriptions.
  • After getting the architecture diagram section, paste it back into a follow-up prompt and ask ChatGPT to generate an OpenAPI contract or AsyncAPI spec for each service boundary — it bridges design to implementation.

Frequently Asked Questions

Will this prompt work if I only have two or three services so far?
Yes, and it is actually most valuable at that stage. The anti-patterns section will flag early mistakes — shared databases, synchronous chains — before they calcify. Fill [services] with what you have and set [pain_points] to your current friction even if it seems minor.
What should I put in [decomposition_strategy] if I do not know which approach to use?
Start with 'Domain-Driven Design bounded contexts' — it is the most widely applicable and produces the most specific boundary recommendations. If your team structure is the primary constraint, use 'team ownership'. If you are migrating a monolith incrementally, use 'strangler fig pattern'. The model will apply whichever lens you give it.
The prompt says 'be opinionated' — does that mean the advice is always right?
No. It means the model commits to a position instead of listing options without guidance. Treat the output as a structured first opinion from a generalist architect, not a signed-off design. Validate circuit breaker and saga recommendations against your actual SLA and team ops capacity — those are context-dependent decisions the model cannot fully resolve from a single prompt.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in ChatGPT Prompts for Developers

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support