Product · Architecture · AWS MVP
Benchframe Flux on AWS: the MVP architecture
One small instance, durable data, optional Macs for iOS.
People use Benchframe Flux through a web app and an iOS app. This page describes how the platform is meant to run on AWS in its first production shape, in four views of the C4 model: system context, containers, the iOS track, and the components of the broker.
Status
Target architecture (MVP), not as-built. This is the intended design. The rollout to AWS has not happened yet, and details can change before it does.
Benchframe Flux in action
What the platform produces
Before the architecture, a look at the product it carries. A user describes an app in one sentence, a person approves the plan at a gate, and the finished web app appears in My apps, ready to open. Behind each step, the operator sees the same run as a workflow canvas. The screens show the Polish interface.
-
1 · Idea One sentence in: describe the app you want in the idea field. -
2 · Approval A human approval gate with three choices: go ahead, which lets the run continue; ask for a change, which sends it back to the agent with your note; or end it with no result. -
3 · Delivery The finished app lands in My apps. -
4 · Result The running app, opened straight from My apps.
Apps Benchframe Flux generates
-
Generated web app: Shared expenses, who owes whom.
Every app starts as one sentence. After a person approves the plan, Benchframe Flux builds the web app, publishes it and adds it to My apps. It opens in any phone browser, with no store review in between.
The operator view
01 · System context (C1)
Who talks to the system
Users and operators reach Benchframe Flux over HTTPS. Behind it sit the services it depends on: GitHub for repositories and pull requests, Anthropic and OpenAI for the Claude and Codex CLI workers, Apple for sign-in, push and TestFlight, Microsoft Entra ID for sign-in, and a low-cost model API for request classification. Operators and Mac hosts use a private network.
- Person
- System in scope
- External system
- Mac host
The key change from the current setup: the Mac stops being part of the system. Two Macs become optional, equal build hosts for the steps that need Xcode. The rest of a run lives on AWS.
02 · Containers (C2)
What runs on the instance
Everything that is ours runs on one EC2 instance under Docker Compose, around a few managed AWS services. Worker containers are started by the broker from a managed pool.
- Person
- Container or component
- Data store
- Managed AWS service
- External system
Design rules
- One active broker. A single broker is active at any time. There are no two brokers writing to two databases during the migration.
- Only port 443 is public. Everything else, including worker links, the operator console, the database and administrative access, is reachable only from inside the instance, over the private network, or through AWS Systems Manager.
- Secrets stay out of files and images. Secrets live in SSM Parameter Store (SecureString) and are read at start by a script that never logs values. Mac hosts keep their own signing keys in the macOS Keychain, never in the cloud.
- Boring building blocks. PostgreSQL 17 runs in Docker Compose on the instance and artifacts go straight to S3. The MVP deliberately has no ECS, EKS, load balancer, RDS, NAT gateway or multi-AZ.
- EU region, own network. One workload account in an EU region, a dedicated VPC with a single public subnet and a fixed public address.
Workers as hybrid containers
- Worker images are built from one Dockerfile in variants for Claude, Claude with slots, Codex and the connector, each with a linux/arm64 build.
- The broker starts containers through its worker-fleet module, which allows only listed images, no privileged mode, all Linux capabilities dropped and no new privileges.
- Each worker declares what it can do (platform, architecture, capabilities, capacity), and the broker routes steps by those declarations.
- The first run uses one-shot containers for Claude and Codex steps and a fixed pool for the connector. Multi-slot workers are enabled only after protocol tests and a security review.
- Worker containers cannot read instance metadata, so a worker never inherits the instance's cloud permissions.
03 · iOS track (C2, hybrid)
Macs only where Xcode is needed
Only steps that need Xcode, Simulator, XCTest or signing go to a Mac. Macs join the broker over the private network, as a remote worker does today.
- Container or component
- Data store
- Mac host
- External system
- Native, not containerized. The iOS worker is a native launchd process on the Mac, because Xcode, Simulator and signing do not exist on Linux. The App Store Connect key stays in that Mac's Keychain.
- Optional and equal. Two Macs are interchangeable peers. Either can take an Xcode step when it is switched on and neither is required. With both off, a normal web, content or SDLC run still completes end to end.
- Hand-off by commit SHA. Coding happens on Linux, then xcodebuild and XCTest run on a Mac at the same immutable commit SHA, then review and the pull request continue on Linux. No writable directory is shared over the network.
- Visible waiting. If no compatible Mac is on, the iOS step waits in the queue with an explicit state instead of hanging unnoticed.
04 · Components (C3)
Inside the broker
The broker is one Spring Boot process organized as a modular monolith. It barely changes internally for AWS. Components that the MVP touches have a dashed amber outline.
- Container or component
- Changed for the MVP
- Data store
- External system
What changes for the MVP
| Component | Change |
|---|---|
storage | S3 endpoint instead of MinIO using the instance role, and secrets read from SSM at start. |
worker-fleet | Claude, Codex and connector pools on EC2 in arm64, worker secrets from SSM, instance metadata blocked for worker containers. |
Idleness health indicator | Idle means no users (no consumer sessions or requests for a set time), no processes (no steps in progress, no CLI processes) and no live runs. A worker connection alone does not count as activity, and a run waiting at a human gate does not block sleep. |
scheduler-service | Schedules cannot fire while the instance sleeps, so the wake-up function starts the machine before a due time. |
agent-manager | The intake router moves from a local model to a low-cost model API (embeddings plus pre-routing). |
consumer-service | Hosted user apps answer only once the instance is up. Moving static apps to S3 and CloudFront is out of scope for the MVP. |
05 · Deployment
How it runs on EC2
The target release flow, from a merged commit to a running version. It reuses what the platform already does today and replaces only the parts tied to a Mac. Like the rest of this page, it describes the intended design, not a system that is live. If the instance is asleep when a release is published, it picks the release up when it wakes.
Deployment flow
- Build an arm64 image Container images are built for the instance's arm64 architecture from one tagged commit, on build machines outside the instance, so a release never spends the instance's CPU credits.
- Push to the registry Images go to a private container registry. Each tag is the full commit identifier and cannot be overwritten.
- Read secrets from Parameter Store On deploy, the instance reads its credentials from SSM Parameter Store with its own role. Nothing secret is baked into an image or kept in the repository.
- Back up and migrate the database Before a new broker version starts, a database backup is written to object storage. Schema migrations run as the new version boots.
- Blue-green switch with an intake pause The new broker starts beside the old one. New orders are paused only for the moment of the switch; traffic moves once the new broker reports ready, then intake resumes. Steps already running carry over.
- Smoke check The running version is compared with the released commit, and a few read-only requests confirm the platform answers through the public entry point.
- Roll back if needed An unhealthy new version is replaced by the previous one automatically. Any earlier commit can be redeployed in one step, and a destructive schema change is undone from the pre-deploy backup.
What carries over and what changes
Reused as-is
- Blue-green broker switch with a short order-intake pause
- Automatic return to the previous version when the new one is unhealthy
- Database backup and restore tooling, with every backup verified before it is trusted
- Worker container images, now built for both architectures
- Hosted web apps, served by the broker from its git mirrors, so no per-app deployment exists
Reworked for AWS
- Secrets move from the macOS Keychain to SSM Parameter Store
- Process supervision moves from launchd to containers and systemd timers
- Artifact storage moves from a local object store to S3
- Release orchestration moves from a hand-run script on a Mac to a pipeline that builds, pushes and triggers the instance
- The public entry moves from a private-network tunnel to HTTPS with a managed certificate and a wake-up page
- Host health guards (disk, CPU, backups) become cloud monitoring alarms
06 · Cost, spot and sleep
How the instance stays cheap
- Data is separate from the machine. PostgreSQL, broker data and the repository mirror sit on their own encrypted EBS volume with deletion protection. The instance can be stopped, or replaced after a spot reclaim, and the same volume and public address are reattached.
- Fast start. A custom arm64 image ships with Docker, pulled container images and worker CLIs. The goal, still to be measured, is that the service responds within a few minutes of a start command.
- Sleeping when idle. An idle timer on the instance polls an idleness health endpoint every few minutes and shuts the machine down after a set period of inactivity.
- Wake-up on demand. A small, stateless function (Node.js) is the only serverless piece, and it only starts and stops the instance. While the machine sleeps, the public address shows a 'starting' page, starts the instance and redirects once it is up.
- Spot with a safety net. A persistent spot request with stop-on-interruption, and an on-demand fallback of the same type when spot capacity is short. The two-minute interruption notice pauses intake and stops the broker gracefully. Interrupted steps are retried after the next start.
- What costs money while it sleeps. EBS volumes and snapshots, the public IPv4 address, S3 storage, and the wake-up path (HTTPS entry, DNS, certificate).
07 · Risks
Known risks and how they are handled
| Risk | Effect | Mitigation |
|---|---|---|
| Spot instance reclaimed during a CLI step | The step restarts and costs twice | Two-minute notice, intake pause, step retry, run state on persistent EBS |
| CPU credits exhausted on a burstable instance type (builds, verify) | Throttled performance | Standard credit mode with no surcharge, measurement, move to a larger family if needed |
| arm64 compatibility of CLIs, git tooling, Remotion, Chrome, ffmpeg | Features unavailable on Graviton | Audit of images and tools before production |
| Hosted apps and schedules while the instance sleeps | Apps unavailable, schedules do not start | Wake before a due time; full 24/7 only in a mode without sleep |
| Changed idleness rule | Machine sleeps mid-work, or never sleeps | Tests on real states: human gate, step in progress, open user session |
| Cold start time | Users wait after a sleep | Custom image with pulled containers, a 'starting' page, measurement |
| One instance, one availability zone | No availability if the zone fails | Accepted for the MVP; managed services and multi-AZ are the next stage |
Outside the MVP
- Auxiliary services from the local stack (search, metrics dashboards). Each will either run on the instance or be replaced by CloudWatch.
- Some integrations: issue-tracker sync, AWS Bedrock as a model lane, and App Store Connect automation outside the Mac hosts.
- Moving to managed AWS services (RDS, ECS, ALB) once availability becomes a requirement.
08 · Talk to us
Questions about the deployment model?
Write to hello@benchframe.com and we will walk you through the design.