FlowFrame DSL Specifications v2.0.0

FlowFrame Architecture DSL Reference

FlowFrame Domain Specific Language (.flow) is a declarative infrastructure-as-code language built to design, compile, visualize, and simulate complex distributed systems and microservices architectures in real time.

Syntax & Token Rules

The DSL follows a concise, JSON-like key-value structure with loose keyword tolerances for maximum developer productivity.

Node Declarations

1// Optional define keyword & flexible casing
2define CLIENT c1 {
3 label: "Mobile Client",
4 requests: [{ endpoint: "/api/v1/posts", key: "rohan" }]
5}
  • The define keyword is optional.
  • Node types can be uppercase or lowercase (e.g. CLIENT or client).
  • Identifiers are unique string names (e.g. c1, s1, lb1).

Connection Syntax

1// Option 1: Direct arrow chaining
2c1 -> gw1 -> lb1 -> s1
3
4// Option 2: Connect keyword
5connect lb1 -> s2
  • Chained connections (a -> b -> c) split into directed edges (a -> b and b -> c).
  • The connect keyword is optional.

Supported Node Schemas (8 Components)

FlowFrame supports 8 core infrastructure component types across frontends, gateways, balancers, workers, caches, databases, queues, and pubsub event brokers.

1. CLIENT & 2. SERVER

Core Runtimes
1// Client definition with HTTP request payload
2define CLIENT c1 {
3 label: "Mobile Client",
4 requests: [
5 { endpoint: "/api/v1/orders", allowedMethods: ["POST"], key: "rohan" }
6 ]
7}
8
9// Server definition with capacity and endpoint configuration
10define SERVER s1 {
11 label: "Order Server Instance 1",
12 capacity: 50,
13 prefetchLimit: 10,
14 acceptedEndpoints: [
15 { endpoint: "/api/v1/orders", allowedMethod: ["POST"] }
16 ],
17 registeredTopics: ["post.created"]
18}

3. GATEWAY & 4. LOADBALANCER

Traffic Management
1// API Gateway with path-based LoadBalancer routing
2define GATEWAY gw1 {
3 label: "AWS API Gateway",
4 strategy: "ROUND_ROBIN",
5 routes: [
6 { path: "/api/v1/orders", target: lb1 },
7 { path: "/api/v1/posts", target: s3 }
8 ]
9}
10
11// Load Balancer with Round-Robin strategy
12define LOADBALANCER lb1 {
13 label: "Order Service LoadBalancer",
14 strategy: "ROUND_ROBIN"
15}

5. REDIS & 6. POSTGRES

State & Storage
1// Redis in-memory cache pre-populated data
2define REDIS r1 {
3 label: "Redis Cache 1",
4 data: [{ key: "rohan", value: "cached data for rohan" }]
5}
6
7// PostgreSQL database relational table data
8define POSTGRES db1 {
9 label: "Postgres Database 1",
10 table: "users",
11 data: [{ key: "rohan", value: "db record data" }]
12}

7. MESSAGEQUEUE & 8. PUBSUB

Asynchronous Messaging
1// Asynchronous RabbitMQ message queue broker
2define MESSAGEQUEUE mq1 {
3 label: "Post Queue",
4 processingType: "FIFO",
5 queueSize: 50,
6 overflowBehavior: "REJECT"
7}
8
9// Redis PubSub event broker for broadcast channels
10define PUBSUB postPubsub {
11 label: "PostPubSub 1",
12 topic: "post.created"
13}

Flagship Enterprise Microservices Blueprint

A complete full-scale microservices system featuring API Gateway, 2 Load Balancers, 7 Servers, RabbitMQ Queue, PubSub Broker, Redis Caches, and PostgreSQL Databases.

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

Error Diagnostics & Validation Rules

The FlowFrame compiler performs strict Lexer, Parser, and Semantic checks prior to visual rendering or simulation execution.

Syntax Errors

Catches unexpected tokens, unclosed braces, or missing identifiers.

Duplicate Checks

Prevents re-declaration of duplicate node identifier names.

Strict Schema Rules

Enforces valid property names per node type using ALLOWED_VARIABLES dictionary.