1// ==========================================
2// FLOWFRAME ARCHITECTURE DSL v2.0.0
3// Flagship Enterprise Microservices Blueprint
4// ==========================================
5
6// 1. End-User Mobile Client Definition
7define CLIENT c1 {
8 label: "Mobile Client",
9 requests: [
10 {
11 endpoint: "/api/v1/orders",
12 allowedMethods: ["POST"],
13 key: "rohan"
14 },
15 {
16 endpoint: "/api/v1/orders",
17 allowedMethods: ["POST"],
18 key: "rohan"
19 },
20 {
21 endpoint: "/api/v1/users",
22 allowedMethods: ["POST"],
23 key: "rohan",
24 body: {
25 topic: "post.created"
26 }
27 },
28 {
29 endpoint: "/api/v1/users",
30 allowedMethods: ["POST"],
31 key: "rohan",
32 body: {
33 topic: "post.created"
34 }
35 },
36 {
37 endpoint: "/api/v1/posts",
38 allowedMethods: ["POST"],
39 key: "rohan"
40 }
41 ]
42}
43
44// 2. Central API Gateway Routing Definition
45define GATEWAY gw1 {
46 label: "AWS API Gateway",
47 strategy: "ROUND_ROBIN",
48 routes: [
49 {
50 path: "/api/v1/orders",
51 target: lb1
52 },
53 {
54 path: "/api/v1/posts",
55 target: s3
56 },
57 {
58 path: "/api/v1/users",
59 target: lb2
60 }
61 ]
62}
63
64// 3. Service Cluster Load Balancers
65define LOADBALANCER lb1 {
66 label: "Order Service LoadBalancer",
67 strategy: "ROUND_ROBIN"
68}
69
70define LOADBALANCER lb2 {
71 label: "User Service LoadBalancer",
72 strategy: "ROUND_ROBIN"
73}
74
75// 4. Order Microservice Application Servers
76define SERVER s1 {
77 label: "Order Server Instance 1",
78 capacity: 50,
79 acceptedEndpoints: [
80 {
81 endpoint: "/api/v1/orders",
82 allowedMethod: ["POST"]
83 }
84 ]
85}
86
87define SERVER s2 {
88 label: "Order Server Instance 2",
89 capacity: 50,
90 acceptedEndpoints: [
91 {
92 endpoint: "/api/v1/orders",
93 allowedMethod: ["POST"]
94 }
95 ]
96}
97
98// 5. Posts Microservice Server
99define SERVER s3 {
100 label: "Posts Server Instance",
101 capacity: 50,
102 acceptedEndpoints: [
103 {
104 endpoint: "/api/v1/posts",
105 allowedMethod: ["POST"]
106 }
107 ]
108}
109
110// 6. User Microservice Application Servers
111define SERVER s4 {
112 label: "User Server Instance 1",
113 capacity: 50,
114 acceptedEndpoints: [
115 {
116 endpoint: "/api/v1/users",
117 allowedMethod: ["POST"]
118 }
119 ]
120}
121
122define SERVER s5 {
123 label: "User Server Instance 2",
124 capacity: 50,
125 acceptedEndpoints: [
126 {
127 endpoint: "/api/v1/users",
128 allowedMethod: ["POST"]
129 }
130 ]
131}
132
133// 7. Asynchronous RabbitMQ Message Queue
134define MESSAGEQUEUE mq1 {
135 label: "Post Queue"
136}
137
138// 8. Queue Consumer Processing Servers
139define SERVER producerPostQueue1 {
140 label: "Consumer Post Server 1",
141 capacity: 100,
142 acceptedEndpoints: [
143 {
144 endpoint: "/api/v1/posts",
145 allowedMethod: ["GET", "POST"]
146 }
147 ],
148 prefetchLimit: 10
149}
150
151define SERVER producerPostQueue2 {
152 label: "Consumer Post Server 2",
153 capacity: 100,
154 acceptedEndpoints: [
155 {
156 endpoint: "/api/v1/posts",
157 allowedMethod: ["GET", "POST"]
158 }
159 ],
160 prefetchLimit: 10
161}
162
163// 9. Primary Database & Cache Clusters (Set 1)
164define POSTGRES db1 {
165 label: "Postgres Database 1",
166 table: "users",
167 data: [
168 {
169 key: "rohan",
170 value: "db record data"
171 }
172 ]
173}
174
175define REDIS r1 {
176 label: "Redis Cache 1",
177 data: [
178 {
179 key: "rohan",
180 value: "cached data for rohan"
181 }
182 ]
183}
184
185// 10. Secondary Database & Cache Clusters (Set 2)
186define POSTGRES db2 {
187 label: "Postgres Database 2",
188 table: "users",
189 data: [
190 {
191 key: "rohan",
192 value: "db record data"
193 }
194 ]
195}
196
197define REDIS r2 {
198 label: "Redis Cache 2",
199 data: [
200 {
201 key: "rohan",
202 value: "cached data for rohan"
203 }
204 ]
205}
206
207// 11. PubSub Event Broker & Subscriber Servers
208define PUBSUB postPubsub {
209 label: "PostPubSub 1"
210}
211
212define SERVER pubsubConsumer1 {
213 label: "PubSub Consumer 1",
214 capacity: 100,
215 acceptedEndpoints: [
216 {
217 endpoint: "/api/v1/posts",
218 allowedMethod: ["GET", "POST"]
219 }
220 ],
221 registeredTopics: ["post.created"]
222}
223
224define SERVER pubsubConsumer2 {
225 label: "PubSub Consumer 2",
226 capacity: 100,
227 acceptedEndpoints: [
228 {
229 endpoint: "/api/v1/posts",
230 allowedMethod: ["GET", "POST"]
231 }
232 ],
233 registeredTopics: ["post.created"]
234}
235
236// ==========================================
237// TOPOLOGY NETWORK CONNECTIONS & DATA FLOWS
238// ==========================================
239
240// Client to API Gateway and Load Balancers
241connect c1 -> gw1 -> lb1 -> s1
242connect lb1 -> s2
243connect gw1 -> s3
244connect gw1 -> lb2
245connect lb2 -> s4
246connect lb2 -> s5
247
248// Order Servers to Message Queue & Consumers
249s1 -> mq1
250s2 -> mq1
251mq1 -> producerPostQueue1
252mq1 -> producerPostQueue2
253producerPostQueue1 -> db1
254producerPostQueue1 -> r1
255producerPostQueue2 -> db1
256producerPostQueue2 -> r1
257
258// User Servers to PubSub Broker & Subscribers
259s4 -> postPubsub
260s5 -> postPubsub
261postPubsub -> pubsubConsumer2
262postPubsub -> pubsubConsumer1
263pubsubConsumer1 -> r2
264pubsubConsumer1 -> db2
265pubsubConsumer2 -> db2
266pubsubConsumer2 -> r2