Flux Documentation
The backend framework where every execution is a record.
flux init my-app
flux dev
functions/hello/index.ts
flux trace <id>
flux why <id>
Start here
Core Concepts
Everything in Flux revolves around the execution record — a complete snapshot produced for every request: span tree, database mutations, inputs, outputs, and errors. All CLI commands are different ways to query that record.
1. Execution Recording
Every request is executed and recorded atomically. The runtime captures every span — gateway, function, database queries — and stores them indexed by request ID. There is no setup required; recording happens at the runtime level.
2. Mutation Logging
Every database write goes through the Data Engine, which logs the mutation — table, row, old value, new value, and the request ID that caused it. flux state history and flux state blame query this log.
3. Incident Replay
Because the complete input to every request is recorded, any request can be deterministically re-executed. flux incident replay disables outbound side-effects while re-running database writes against the current code.
Architecture
| Module | Purpose | Link |
|---|---|---|
| Gateway | Auth, rate limiting, CORS, routing | docs/gateway |
| Runtime | Deno V8 + Wasmtime execution, secrets | docs/runtime |
| Data Engine | DB proxy, mutation recording, cron | docs/data-engine |
| Queue | Durable async job processing | docs/queue |
| API | Function registry, schema, management | docs/api |
All five modules run in a single binary on port :4000. One Postgres database holds all state.
Debugging Reference
| Question | Command |
|---|---|
| Why did this request fail? | flux why <id> |
| What happened in this request? | flux trace <id> |
| Step through it interactively? | flux trace debug <id> |
| How did two requests differ? | flux trace diff <a> <b> |
| What changed in the database? | flux state history <table> --id <row> |
| Who set this field? | flux state blame <table> --id <row> |
| Replay the incident safely? | flux incident replay <from>..<to> |
| Which commit broke it? | flux bug bisect --request <id> |