Skip to main content

Local Distributed Stack

This distributed use case shows how FlowLayer can coordinate a realistic development stack from one runtime session: API, workers, Kafka producers and consumers, plus data services like Postgres and Redis.

This pattern is for development and simulation. It is not a production orchestration model.

Server config for a local distributed stack

{
"session": {
"bind": "127.0.0.1:6999",
"token": "dev-token-local-stack"
},
"services": {
"postgres": {
"cmd": ["postgres", "-D", "./var/postgres"],
"port": 5432,
"ready": {
"type": "tcp"
}
},
"redis": {
"cmd": ["redis-server", "./infra/redis.conf"],
"port": 6379,
"ready": {
"type": "tcp"
}
},
"kafka": {
"cmd": ["kafka-server-start.sh", "./infra/kafka/server.properties"],
"port": 9092,
"ready": {
"type": "tcp"
}
},
"api": {
"cmd": ["pnpm", "--dir", "services/api", "dev"],
"dependsOn": ["postgres", "redis", "kafka"],
"port": 3000,
"ready": {
"type": "http",
"url": "http://127.0.0.1:3000/health"
}
},
"worker": {
"cmd": ["pnpm", "--dir", "services/worker", "dev"],
"dependsOn": ["api", "redis", "kafka"]
},
"orders-producer": {
"cmd": ["pnpm", "--dir", "services/orders-producer", "dev"],
"dependsOn": ["api", "kafka"]
},
"orders-consumer": {
"cmd": ["pnpm", "--dir", "services/orders-consumer", "dev"],
"dependsOn": ["kafka", "postgres", "redis"]
}
}
}

Start the server runtime

flowlayer-server -c ./flowlayer.jsonc

Connect the official TUI

Use explicit session flags:

flowlayer-client-tui -addr 127.0.0.1:6999 -token dev-token-local-stack

Or keep a separate client config file:

{
"session": {
"addr": "127.0.0.1:6999",
"token": "dev-token-local-stack"
}
}
flowlayer-client-tui -config ./flowlayer.tui.jsonc

Server and client config stay separate:

  • server listens with session.bind
  • client connects with session.addr
  • do not reuse server config as TUI config unless you authored it for that purpose

Practical operations

In one session, you can:

  • restart only orders-consumer after schema or topic changes
  • stop and start worker without touching api
  • inspect Kafka-facing services and API logs side by side from the TUI

Command contracts are described in Actions and Logs.

Boundaries

  • FlowLayer is not a production orchestrator.
  • FlowLayer does not replace Kubernetes, Docker Compose, PM2, or systemd.
  • Use this pattern to simulate distributed development behavior and runtime interactions.