@@ -10,10 +10,55 @@ Otávio Santana
1010
1111[source, mermaid]
1212----
13+ C4Context
14+ title System Context – Hybrid REST + gRPC Integration
15+
16+ Enterprise_Boundary(company, "Company System") {
17+ Person(customer, "🧑 Customer", "Places orders via web or mobile")
18+
19+ System(backend, "🟦 Java Backend", "Handles checkout, payment, and stock coordination")
20+
21+ System_Boundary(internal, "Internal Services") {
22+ System(stock_service, "📦 Stock Service", "Validates stock availability")
23+ SystemDb(stock_db, "🗃️ Inventory DB", "Stores stock levels")
24+ }
25+ }
26+
27+ System_Ext(payment_provider, "💳 Payment Provider", "External REST API for payment processing")
28+
29+ Rel(customer, backend, "Places order", "HTTPS/REST")
30+ Rel(backend, payment_provider, "Initiates payment", "HTTPS/REST")
31+ Rel(payment_provider, backend, "Webhook (confirmation)", "HTTPS/REST")
32+ Rel(backend, stock_service, "checkAvailability()", "gRPC")
33+ Rel(stock_service, stock_db, "Reads/Writes", "SQL")
34+
35+ UpdateLayoutConfig($c4ShapeInRow="2", $c4BoundaryInRow="1")
1336----
1437
1538== C4Container – REST Payment Integration
1639
1740[source, mermaid]
1841----
42+ C4Container
43+ title Container Diagram – REST for Payment, gRPC for Stock
44+
45+ Person(customer, "🧑 Customer", "Uses the system to shop and pay")
46+
47+ System_Ext(payment_provider, "💳 Payment Provider", "External payment gateway (e.g., Stripe)")
48+
49+ Container_Boundary(app, "Company Backend System") {
50+ Container(client_app, "Client App", "React / Mobile", "Provides UI for shopping and payment")
51+ Container(backend, "Java Backend", "Spring Boot", "Handles requests and business logic")
52+ Container(stock_service, "Stock Service", "Java + gRPC", "Manages inventory availability")
53+ ContainerDb(stock_db, "Inventory DB", "PostgreSQL", "Stores stock info")
54+ }
55+
56+ Rel(customer, client_app, "Uses", "HTTPS")
57+ Rel(client_app, backend, "Places order", "HTTPS/REST")
58+ Rel(backend, payment_provider, "REST payment", "HTTPS")
59+ Rel(payment_provider, backend, "Sends webhook", "HTTPS")
60+ Rel(backend, stock_service, "checkAvailability()", "gRPC")
61+ Rel(stock_service, stock_db, "Reads/Writes", "SQL")
62+
63+ UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
1964----
0 commit comments