Prompt Details
Model
Chat - (gpt-5.6)
Token size
4,255
Example input
[SYSTEMS_AND_SERVICES]: Shopify store Payment gateway Inventory database Warehouse service Shipping provider Customer email service PostgreSQL integration database
[BUSINESS_WORKFLOWS_AND_INTEGRATION_GOALS]: Customer places an order. Payment is confirmed. Inventory is reserved. Warehouse fulfills the order. Shipping is created. Customer receives status updates.
[DATA_FLOWS_AND_ENTITIES]: Customer Product Order Payment Inventory Shipment Order-status events
[VOLUME_TIMING_AND_CONSISTENCY_REQUIREMENTS]: 5,000 orders/day Peak: 20 orders/minute Payment and inventory updates: near-real-time Reporting data: eventually consistent
[CURRENT_ARCHITECTURE_AND_CONSTRAINTS]: Small engineering team PostgreSQL already exists No dedicated integration platform Need low operational complexity Provider limits and exact API capabilities must be verified
Example output
🔎 PHASE 1 — Integration Context Reconstruction
Systems Identified
System Role Status
Shopify Commerce platform 🟢 Confirmed
Payment Gateway Payment processing 🟢 Confirmed
PostgreSQL Integration/state database 🟢 Confirmed
Inventory DB Inventory ownership 🟢 Confirmed
Warehouse Fulfillment 🟡 Capability unknown
Shipping Provider Shipment creation/tracking 🟡 Capability unknown
Email Service Customer notifications 🟢 Proposed
📌 Classification
CONFIRMED: Shopify, payment gateway, PostgreSQL, inventory database.
ASSUMED: Payment webhook availability.
PROPOSED: Integration service, queue, notification service.
UNKNOWN: Exact warehouse and shipping APIs, provider rate limits, webhook semantics.
🎯 Integration Goal
Create a controlled integration layer so that the commerce platform does not become tightly coupled directly to every downstream system.
---
🗺️ PHASE 2 — System & Boundary Architecture
🛒 Shopify
Purpose: Customer-facing commerce.
Data owned: Orders and storefront information.
Consumes: Inventory and fulfillment status.
Criticality: 🔴 High.
Boundary: External SaaS.
💳 Payment Gateway
Purpose: Payment authorization/capture.
Data owned: Payment transaction state.
Criticality: 🔴 High.
Boundary: External financial system.
📦 Inventory Database
Purpose: Inventory state.
Data owned: Available/reserved stock.
Criticality: 🔴 High.
Boundary: Internal.
🏭 Warehouse
Purpose: Physical fulfillment.
Data owned: Fulfillment execution.
Criticality: 🔴 High.
Capability: 🟡 Unknown.
🚚 Shipping Provider
Purpose: Shipment creation/tracking.
Data owned: Shipment/tracking state.
Capability: 🟡 Unknown.
🧩 Integration Service
Purpose: Orchestration, transformation, retry, idempotency and reconciliation.
Data owned: Integration state, processing metadata and mappings.
Type: System of Transformation.
🗄️ PostgreSQL
Purpose: Integration state and reconciliation.
Type: Supporting persistence.
🔐 Trust Boundaries
Customer
↓
Shopify
↓
🔐 External/Internal Boundary
↓
Integration Service
├── Payment Gateway
├── Inventory
├── Warehouse
├── Shipping
└── Notification Service
---
🧬 PHASE 3 — Data Flow & Entity Mapping
🔄 Main Order Flow
Shopify
↓
Order Event
↓
Integration Service
↓
Payment Validation
↓
Inventory Reservation
↓
Warehouse Fulfillment
↓
Shipping Creation
↓
Customer Notification
📋 Entity Mapping Matrix
Source Entity Source Field Target Entity Target Field Transformation Owner
Order order_id IntegrationOrder external_order_id Direct mapping Shopify
Order customer_email Customer email Validation/normalization Shopify
Order items InventoryReservation items SKU mapping Inventory
Order total PaymentRequest amount Currency validation Payment
Order shipping_address Shipment destination Address normalization Shopify
Payment transaction_id PaymentRecord provider_transaction_id Direct mapping Payment
Shipment tracking_number Order tracking_number Direct mapping Shipping
⚠️ Data Risks
SKU mismatch
Currency mismatch
Missing customer fields
Duplicate order events
Address validation failures
Different status models
Provider-specific identifiers
---
🔌 PHASE 4 — Integration Pattern Selection
Integration Pattern Reason Latency
Shopify → Integration Webhook/event Avoid unnecessary polling Near-real-time
Integration → Payment API Payment confirmation requires controlled request Low
Integration → Inventory Internal API/transaction Reservation requires atomic business logic Low
Integration → Warehouse API/queue Depends on provider capability TBD
Integration → Shipping API Shipment creation Low/medium
Integration → Email Queue/event Notification should not block order flow Asynchronous
🎯 Architecture Decision
Do not make customer notification part of the synchronous order-critical path.
---
📡 PHASE 5 — API & Contract Architecture
🔗 Order Processing Interface
Purpose: Start processing an order.
Consumer: Integration Service
Provider: Internal order-processing component
Request
{
"event_id": "[EVENT_ID]",
"order_id": "[ORDER_ID]",
"customer_id": "[CUSTOMER_ID]",
"items": [
{
"sku": "[SKU]",
"quantity": "[QUANTITY]"
}
],
"currency": "[CURRENCY]",
"amount": "[AMOUNT]"
}
Required Controls
🔐 Authentication: provider-supported mechanism.
🛡️ Authorization: minimum required scope.
🔑 Idempotency key: event_id.
⏱️ Timeout: bounded and explicitly configured.
🔁 Retry: bounded exponential backoff.
📦 Error model: structured error code + retryability indicator.
🔢 Versioning: versioned contract.
⚠️ Important
Exact Shopify, payment, warehouse or shipping endpoints are not invented here. They must be confirmed from the actual provider documentation/capabilities before implementation.
---
🔐 PHASE 6 — Authentication & Security Architecture
🔑 Credential Model
Integration Service
↓
Secrets Manager
↓
Provider Credential
↓
External API
Security Controls
🔐 TLS for network communication.
🔑 Credentials stored outside source code.
🔄 Credential rotation.
🛡️ Least-privilege permissions.
🚫 No secrets in logs.
🚫 No unnecessary payment-sensitive data storage.
🧾 Audit authentication failures.
🔏 Verify webhook signatures if the provider supports signed webhooks.
👤 Ownership
Application credentials → Platform/engineering owner.
Payment credentials → Authorized payment integration owner.
Secrets → Security/platform-controlled storage.
---
🔄 PHASE 7 — Data Synchronization Strategy
🛒 Order
Source of truth: Shopify for commerce order state.
💳 Payment
Source of truth: Payment provider for payment transaction state.
📦 Inventory
Source of truth: Inventory system.
🚚 Shipment
Source of truth: Shipping provider for shipment/tracking state.
🔄 Synchronization
Shopify
↓
Order Event
↓
Integration Service
↓
Internal State
↓
Downstream Systems
Strategy
Orders → event-driven.
Payment status → webhook/event if supported.
Inventory → near-real-time.
Shipment tracking → event/webhook if supported, otherwise controlled polling.
Reconciliation → scheduled comparison.
⚠️ Bidirectional Sync Risk
Avoid:
Shopify ↔ Inventory
with both systems independently modifying stock.
Instead:
Inventory System
↓
Inventory State
↓
Integration Layer
↓
Shopify
The ownership direction must remain explicit.
---
🧮 PHASE 8 — Idempotency, Duplicates & Consistency
🔑 Idempotency Strategy
Each incoming event receives a unique:
event_id
Store:
event_id
processing_status
first_seen_at
completed_at
entity_id
Duplicate Event
If:
event_id = ABC123
arrives twice:
First → Process
Second → Detect duplicate → Do not repeat side effect
🧱 Database Protection
Use unique constraints where appropriate:
UNIQUE(event_id)
UNIQUE(provider_transaction_id)
UNIQUE(shipment_id)
Delivery Semantics
Assume:
At-least-once delivery
unless the complete architecture provides evidence for another guarantee.
❌ Do Not Claim
> "The system provides exactly-once processing."
Instead:
> "The system tolerates duplicate delivery through idempotency and deduplication."
---
🛡️ PHASE 9 — Failure, Retry & Resilience
💳 Payment API Failure
Detection
↓
Retryable?
↓
Yes
↓
Exponential Backoff
↓
Bounded Retry
↓
Success / DLQ
↓
Alert
Failure Matrix
Failure Retry? Action
Network timeout ✅ Retry
5xx provider error ✅ Backoff + retry
Rate limit ✅ Respect provider signal/backoff
Authentication failure ❌ initially Alert + credential investigation
Invalid payload ❌ Quarantine
Duplicate event ❌ Deduplicate
Provider outage 🟡 Queue + controlled retry
Database failure 🟡 Retry transaction safely
🚨 Retry Protection
Maximum retry attempts.
Exponential backoff.
Jitter.
Dead-letter/quarantine.
Alerting.
No infinite retries.
No uncontrolled retry loops.
---
🚦 PHASE 10 — Rate Limiting & Capacity
Known Volume
Average: ~5,000 orders/day.
Peak: ~20 orders/minute.
Provider Limits
🟡 UNKNOWN
No provider rate limits should be fabricated.
Controls
Request throttling.
Queue buffering.
Exponential backoff.
Batch operations where provider supports them.
Connection reuse.
Caching for non-critical reads.
Monitoring of HTTP 429/rate-limit responses.
Capacity Signals
Monitor:
Requests/minute
Queue depth
Processing latency
429 responses
Concurrent requests
Retry volume
---
🔍 PHASE 11 — Observability & Reconciliation
📊 Metrics
Track:
Order processing success rate.
Payment failure rate.
Inventory reservation failures.
API latency.
Retry count.
Queue depth.
Dead-letter count.
Event processing lag.
Synchronization gaps.
Reconciliation mismatches.
🆔 Correlation Model
correlation_id
↓
request_id
↓
event_id
↓
order_id
↓
provider_transaction_id
↓
shipment_id
This allows one customer order to be traced across the entire architecture.
🔄 Reconciliation
Example:
Shopify Orders
vs
Integration Database
vs
Payment Records
vs
Inventory Records
vs
Shipment Records
Flag:
Missing payment.
Missing inventory reservation.
Missing shipment.
Incorrect status.
Duplicate records.
Stale integration state.
---
🧪 PHASE 12 — Integration Testing Architecture
🧪 Test Matrix
Test Input Expected Output Pass Condition
Normal order Valid order Full processing Shipment created
Duplicate event Same event twice One side effect No duplicate
Payment timeout Timeout response Controlled retry No duplicate payment
Invalid SKU Unknown SKU Rejection/quarantine Inventory unchanged
Rate limit 429 response Backoff No retry storm
Provider outage 5xx Queue/retry Event eventually processed
Schema mismatch Invalid field Validation failure Event quarantined
Auth failure Invalid credential Request rejected Alert generated
Reconciliation Missing shipment Mismatch detected Incident created
🔐 Security Tests
Credential exposure test.
Unauthorized API access.
Invalid token.
Expired credential.
Webhook signature validation.
Sensitive-data logging test.
🔄 Reliability Tests
Duplicate event.
Out-of-order event.
Retry exhaustion.
Dead-letter recovery.
Database restart.
Provider outage.
---
🏗️ PHASE 13 — Deployment & Change Management
🌎 Environments
Development
↓
Staging
↓
Production
🔐 Configuration
Separate:
API credentials.
Provider URLs.
Rate-limit configuration.
Retry policies.
Database credentials.
Feature flags.
🚀 Deployment Strategy
1. Deploy integration service.
2. Validate provider connectivity.
3. Enable read/non-destructive flows.
4. Run controlled test transactions.
5. Enable production processing gradually.
6. Monitor errors and reconciliation.
7. Expand traffic.
↩️ Rollback
Rollback must consider:
Already-processed orders.
Duplicate events.
Database schema changes.
Queue messages.
External side effects.
A code rollback alone may not reverse external transactions.
---
📊 PHASE 14 — Performance, Cost & Operations
Main Cost Drivers
API requests.
Database storage.
Queue/message processing.
Logging and monitoring.
External provider charges.
Data transfer.
Optimization
⚡ Cache non-critical reads.
📦 Batch operations where supported.
🔄 Prefer events over unnecessary polling.
🗜️ Minimize payload size.
🔗 Reuse connections.
🧹 Retain operational logs according to requirements.
📊 Monitor unnecessary API calls.
Important
Provider pricing is UNKNOWN until actual providers are identified.
---
⚠️ PHASE 15 — Integration Risk Register
Risk Impact Likelihood Detection Mitigation Owner
Provider outage 🔴 High 🟡 Medium API errors Queue + retry Platform
Duplicate events 🔴 High 🟡 Medium Event ID Idempotency Integration
Schema drift 🔴 High 🟡 Medium Contract tests Versioning Engineering
Rate-limit exhaustion 🟠 Medium 🟡 Medium 429 metrics Throttling Platform
Credential expiry 🔴 High 🟢 Low/Unknown Auth errors Rotation Security
Inventory divergence 🔴 High 🟡 Medium Reconciliation Source-of-truth rules Inventory
Warehouse API unavailable 🔴 High 🟡 Unknown Health/error metrics Queue + quarantine Fulfillment
Sensitive data leakage 🔴 High 🟢 Low Security audit Redaction Security
Hidden point-to-point coupling 🟠 Medium 🟡 Medium Architecture review Integration layer Architect
---
🏆 PHASE 16 — Final Software Integration Blueprint
1. 📋 Executive Summary
The proposed architecture uses a dedicated Integration Service as the controlled transformation and orchestration boundary.
Core transactional systems remain owners of their respective domains:
Shopify → Commerce
Payment → Payment
Inventory → Stock
Warehouse → Fulfillment
Shipping → Shipment
The integration layer handles:
🔄 Transformation
🔑 Idempotency
🛡️ Retry
📦 Queueing
🔍 Observability
🔄 Reconciliation
🧾 Integration state
---
2. 🗺️ System Landscape
┌──────────────┐
│ Customer │
└──────┬───────┘
↓
┌──────────────┐
│ Shopify │
└──────┬───────┘
↓
┌──────────────┐
│ Integration │
│ Service │
└──────┬───────┘
┌────────────┼────────────┐
↓ ↓ ↓
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Payment │ │Inventory │ │Warehouse │
└──────────┘ └──────────┘ └────┬─────┘
↓
┌──────────┐
│ Shipping │
└──────────┘
---
3. 🔌 Integration Architecture
Core components
Shopify connector.
Payment connector.
Inventory adapter.
Warehouse adapter.
Shipping adapter.
Event/queue layer.
Integration-state database.
Reconciliation worker.
Notification worker.
Observability stack.
The adapters isolate provider-specific behavior from core business logic.
---
4. 🔄 Data Flow Architecture
Order
Shopify
↓
Order Event
↓
Integration Service
↓
Validate
↓
Payment
↓
Inventory
↓
Warehouse
↓
Shipping
↓
Notification
Failure path
Integration Failure
↓
Retryable?
↙ ↘
YES NO
↓ ↓
Retry Quarantine
↓ ↓
Success Alert
---
5. 📊 Integration Pattern Matrix
Integration Pattern Reason Latency Reliability Complexity
Shopify → Integration Webhook/event Event-driven order processing Near-real-time High with retry Medium
Integration → Payment API Transaction control Low High with idempotency Medium
Integration → Inventory Transaction/API Reservation Low High Medium
Integration → Warehouse API/queue Fulfillment TBD TBD TBD
Integration → Shipping API/event Shipment processing Low/medium High with retry Medium
Integration → Email Queue Non-critical side effect Async High Low
---
6. 📡 API & Event Contracts
Every interface should define:
Contract Version
↓
Authentication
↓
Authorization
↓
Request Schema
↓
Response Schema
↓
Validation
↓
Error Model
↓
Timeout
↓
Retry
↓
Idempotency
No provider-specific endpoint should be implemented until its actual documentation/capability is verified.
---
7. 🔐 Authentication & Security
Application
↓
Secrets Manager
↓
Credential
↓
Provider API
Controls:
🔒 TLS.
🔑 Secret management.
🔄 Credential rotation.
🛡️ Least privilege.
🧾 Audit logs.
🚫 No credentials in code.
🚫 No unnecessary sensitive payload logging.
---
8. 🔄 Synchronization Strategy
Domain Source of Truth Direction
Orders Shopify Shopify → Integration
Payments Payment Provider Provider → Integration
Inventory Inventory System Inventory → Integration → Shopify
Fulfillment Warehouse Warehouse → Integration
Shipment Shipping Provider Provider → Integration
Notifications Integration Integration → Email
---
9. 🛡️ Reliability Architecture
Every critical operation gets:
Timeout
+
Bounded Retry
+
Exponential Backoff
+
Jitter
+
Idempotency
+
Dead-Letter
+
Alert
+
Recovery Procedure
This prevents uncontrolled retry storms and duplicate side effects.
---
10. 🔍 Observability Architecture
Metrics
📈 Throughput.
⏱️ Latency.
❌ Error rate.
🔁 Retry rate.
📦 Queue depth.
💀 Dead-letter volume.
🕐 Event lag.
🔄 Reconciliation mismatch count.
Logs
Use structured logs containing:
correlation_id
event_id
order_id
system
operation
status
error_code
Sensitive information should be redacted.
---
11. 🧪 Testing Blueprint
Testing must cover:
🧪 Contract tests.
🔌 API tests.
🔄 End-to-end tests.
🔐 Security tests.
🔁 Retry tests.
🔂 Idempotency tests.
🚦 Rate-limit tests.
📦 Queue failure tests.
🔀 Ordering tests.
🔄 Reconciliation tests.
📊 Performance tests.
↩️ Recovery tests.
---
12. 🚀 Deployment & Migration Plan
Recommended sequence
1. 🏗️ Build integration service.
2. 🗄️ Create integration-state database.
3. 🔐 Configure secrets.
4. 🔌 Implement provider adapters.
5. 🧪 Add contract tests.
6. 📦 Add queue/retry infrastructure.
7. 🔍 Add observability.
8. 🔄 Implement reconciliation.
9. 🧪 Run staging tests.
10. 🚀 Gradually enable production traffic.
11. 📊 Monitor.
12. 🔄 Expand after validation.
---
13. 💰 Cost & Performance Strategy
Primary optimization opportunities:
📦 Batch API operations where supported.
⚡ Cache read-heavy data.
🔄 Avoid unnecessary polling.
🗜️ Reduce payload size.
🔗 Reuse connections.
📊 Monitor API-call efficiency.
🧹 Control log retention.
Actual provider pricing and quotas remain UNKNOWN until providers are specified.
---
14. ⚠️ Integration Risk Register
Highest architectural concerns:
1. 🔴 Provider outage.
2. 🔴 Inventory divergence.
3. 🔴 Duplicate payment side effects.
4. 🔴 Schema changes.
5. 🟠 Rate-limit exhaustion.
6. 🟠 Credential expiration.
7. 🟠 Warehouse capability uncertainty.
8. 🟠 Shipping integration uncertainty.
---
15. 🛠️ Implementation Task Plan
Task System Dependency Priority Acceptance Criteria
Define ownership All Business approval P0 Every domain has one owner
Verify provider APIs External systems Provider docs P0 Capabilities documented
Build integration service Integration Architecture P0 Core orchestration works
Implement idempotency Integration DB Database P0 Duplicate events create no duplicate side effects
Implement retry engine Integration Queue P0 Bounded retry works
Implement adapters Providers API verification P0 Contract tests pass
Add observability Platform Integration P1 Correlation IDs trace flows
Build reconciliation Database/providers Data access P1 Divergence detected
Security review Security Integration P1 Least-privilege verified
Production rollout Platform Testing P1 Controlled deployment succeeds
---
🧠 16. Final Architecture Decision Record
ADR-001: Use an Integration Service
Decision: 🟢 Use a dedicated integration service.
Reason: Reduces uncontrolled point-to-point coupling and centralizes transformation, retries, observability and reconciliation.
Alternative: Direct Shopify → Payment → Warehouse → Shipping connections.
Trade-off: Adds another operational component.
Dependency: Engineering team must operate the service.
Revisit Trigger: If integration volume or complexity becomes significantly different.
---
ADR-002: Use At-Least-Once Processing
Decision: 🟢 Design for duplicate delivery.
Reason: More realistic for distributed event processing.
Alternative: Attempt exactly-once architecture.
Trade-off: Requires idempotency and deduplication.
Revisit Trigger: Provider delivery semantics or business requirements materially change.
---
ADR-003: Separate Transactional and Notification Processing
Decision: 🟢 Customer email should be asynchronous.
Reason: Email failure should not block order processing.
Alternative: Send email synchronously during order processing.
Trade-off: More asynchronous infrastructure.
Revisit Trigger: If notification requirements become transaction-critical.
---
✅ Confirmed Architecture Decisions
🟢 Each major data domain has an explicit owner.
🟢 Integration Service acts as the transformation boundary.
🟢 Critical operations use bounded retries.
🟢 Duplicate processing is handled through idempotency.
🟢 Reconciliation is required.
🟢 Sensitive credentials remain outside application code.
🟢 Notification processing is asynchronous.
🟡 Assumptions
Payment provider exposes a usable integration mechanism.
Shopify event/webhook capabilities are available for the required workflow.
Warehouse can expose an API, queue, or file-based interface.
Shipping provider provides an integration mechanism.
PostgreSQL can store integration state.
❓ Open Questions
Which payment provider is being used?
Which warehouse system is being used?
Which shipping provider is being used?
What are their exact API capabilities?
What are their documented rate limits?
What authentication mechanisms do they support?
What are their webhook delivery guarantees?
What are the required order-processing SLAs?
🔎 External Capabilities to Verify
API endpoints.
Webhooks.
Event schemas.
Authentication.
Authorization scopes.
Rate limits.
Pagination.
Timeout behavior.
Error codes.
API versions.
Provider maintenance behavior.
Webhook retry semantics.
🚨 Critical Failure Modes
Provider Outage
↓
Queue
↓
Bounded Retry
↓
Dead Letter
↓
Alert
↓
Manual/Automated Recovery
↓
Reconciliation
Critical data-loss prevention depends on durable event/state storage and reconciliation.
🚀 Recommended Implementation Sequence
1. System Discovery
↓
2. Ownership Definition
↓
3. Provider Capability Verification
↓
4. Contract Design
↓
5. Integration Service
↓
6. Idempotency
↓
7. Queue + Retry
↓
8. Provider Adapters
↓
9. Observability
↓
10. Reconciliation
↓
11. Security Testing
↓
12. Failure Testing
↓
13. Staging
↓
14. Controlled Production Rollout
↓
15. Continuous Reconciliation & Operations
Overall test outcome: 🟢 The blueprint is implementation-oriented, but production readiness cannot be claimed yet because the actual provider APIs, authentication mechanisms, rate limits, webhook behavior, and warehouse/shipping capabilities are still unverified.
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Connecting multiple APIs, SaaS platforms, databases, and internal services is rarely just a matter of wiring endpoints together. Real integrations need data contract
🔗 Map APIs, SaaS tools, databases & internal services
🏗️ Design the complete integration architecture
🧬 Trace data across systems
📡 Define API and event contracts
🔐 Design authentication & authorization boundaries
🔄 Choose sync, async, webhook, queue, or batch patterns
🛡️ Handle retries, failures, duplicates & partial outages
...more
Added over 1 month ago
