Fluxme.io
Flux Ecosystem

Network Architecture

How Flux works under the hood — blockchain, FluxOS, FDM domain management, Syncthing, and the API gateway.

12 min read
architecturefdmhaproxysyncthing

Network Architecture — How Flux Works Under the Hood

The Flux network is a complex system of interconnected components: a blockchain for consensus, FluxOS for compute orchestration, a domain management system for traffic routing, and multiple APIs for data access. Understanding this architecture helps operators troubleshoot issues and developers build on the platform.

Architecture Overview

  • Flux Blockchain (fluxd): C++ daemon (Zcash fork) — handles consensus, collateral, node registration, and app specifications on-chain
  • FluxOS: MEVN application (MongoDB, Express, Vue, Node.js) — orchestrates Docker containers, manages P2P communication, exposes the REST API
  • FluxBench: Hardware benchmarking daemon — periodically tests CPU, RAM, SSD, and network performance
  • FDM (Flux Domain Manager): HAProxy-based load balancer — manages DNS records, SSL certificates, and traffic routing
  • Stats API: Network-wide data aggregator — collects information from all nodes for dashboards and monitoring

Network Communication

Flux nodes communicate peer-to-peer using a gossip protocol. Each node maintains connections to other nodes:

  • Outgoing connections: Your node initiates connections to known peers
  • Incoming connections: Other nodes connect to your node
  • Message broadcast: Messages (app deployments, updates, hash verification) propagate through the network via gossip
  • DOS protection: The network monitors node behavior and can temporarily ban misbehaving nodes

Domain Manager (FDM)

FDM is responsible for making Flux applications accessible via standard domain names. It dynamically manages HAProxy configuration to route traffic to healthy nodes:

Domain PatternRoutes To
home.runonflux.ioFlux UI (load-balanced across healthy nodes)
api.runonflux.ioFlux API (load-balanced)
APPNAME.app.runonflux.ioApplication (load-balanced across running instances)
APPNAME_PORT.app.runonflux.ioMulti-port application endpoints

FDM integrates with Cloudflare and/or PowerDNS for DNS record management, and uses Let's Encrypt with Certbot for automatic SSL certificate provisioning.

Data Flow: Deploying an App

  1. 1

    User submits spec

    The app specification (Docker image, resources, instances) is signed by the user and broadcast to the Flux network.

  2. 2

    On-chain registration

    The specification is recorded on the Flux blockchain as a transaction, including the payment in FLUX.

  3. 3

    Network propagation

    FluxOS nodes receive the spec via gossip protocol and check if they have sufficient resources.

  4. 4

    Container deployment

    Eligible nodes pull the Docker image and start the container according to the spec.

  5. 5

    Health monitoring

    FluxOS continuously monitors container health. If a node goes down, the app is redeployed elsewhere automatically.

  6. 6

    DNS routing

    FDM detects the running instances and creates DNS records pointing to all healthy nodes running the app.

  7. 7

    Traffic distribution

    HAProxy load-balances incoming requests across all instances. SSL is terminated at the FDM level.

Key API Gateways

GatewayURLDescription
Production APIapi.runonflux.ioLoad-balanced API across all healthy nodes
Backup APIapi.runonflux.comBackup production endpoint
Stats APIstats.runonflux.ioAggregated network statistics
Explorerexplorer.runonflux.ioBlockchain explorer
Direct NodeNODE_IP:16127Direct access to a specific node's API
Testnettestnet-api.runonflux.ioTestnet API for development

MongoDB Databases

Each FluxOS node maintains local MongoDB databases:

DatabasePurpose
zelfluxlocalLogged users, login phrases, signatures, payments, geolocation cache, benchmark cache
zelcashdataScanned block height, UTXO index, address transactions, FluxNode transactions, app hashes
localzelappsLocally installed app information and metadata
globalzelappsNetwork-wide app messages, specifications, deployment locations, install errors
chainparamsChain-level parameters and soft fork messages
zelshareFluxShare file sharing metadata

Syncthing — Distributed File Sync

Flux uses Syncthing for decentralized file synchronization between nodes running the same application. When an app writes data to persistent storage, Syncthing ensures all instances of that app maintain consistent data across nodes. This is critical for stateful applications like databases and content management systems.

The FluxOS API exposes 50+ Syncthing management endpoints under /syncthing/ for configuring devices, folders, and sync status. These are used internally by FluxOS and are generally not needed by operators.