docs/v5/architecture/adr/0003-flux-connection-broker-boundary.md
Accepted.
Coolify v5 needs to send host primitive requests to many managed hosts, including hosts behind NAT, firewalls, or corporate networks. coold can solve the host inbound problem by dialing out, but Laravel request workers should not own thousands of long-lived HTTP/2 agent streams or in-memory pending response maps.
The system also needs a place to translate between Coolify's short-lived local request/response lane and coold's long-lived outbound stream without turning that place into another product control plane.
Flux is the central connection broker between Coolify Laravel and coold agents. Laravel talks to Flux over a local Unix socket. coold agents dial Flux over an outbound authenticated gRPC stream. Flux keeps the connected-host stream registry, routes requests to the selected host stream, tracks pending request IDs, and resolves typed responses back to Laravel.
Flux owns transport concerns: stream lifecycle, request correlation, timeouts, disconnected-host responses, pending-request caps, late-result handling, and host-agent authentication for inbound coold streams.
Flux must not own Coolify product concepts. It does not decide which user may
deploy, which host should run an application, what a domain means, how rollback
works, or how deployment state advances. Flux treats containers.start or
images.pull as protocol frames routed to a host, not as product actions.