---
title: "Architecture"
description: "A cluster of af-server nodes, each replicating every Raft group, the platform's, each organization's and each repository's, so a busy repository never slows another."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

Atoll Forge is three programs. `af` is what people use, and `af mcp`, the same binary, is how agents connect. `af-runner` runs checks and builds on machines of their own. `af-server` is the forge: one or more nodes that together form a **cluster**, holding every organization the cluster serves and every repository in them.

## Three levels, a group each

What the forge holds is split into three levels, and each has a Raft group of its own: its own replicated databases, its own leader and its own order of writes.

| Level | Holds |
| --- | --- |
| **Platform** | The cluster's nodes, its organizations and its administrators |
| **Organization** | Its identity provider, people and their sign-ins, the agents born under them, roles, restricted folders, runners and keys |
| **Repository** | `main`, changes, the operation log, the commits and files, and test jobs |

A busy repository therefore never slows another: each lands its own changes in its own order, as TiKV and CockroachDB split their data into ranges and Gitaly Cluster replicates each repository on its own. Organizations are isolated from one another: nothing of one is named, read or shared by another, and each signs its records with its own keys.

## Every node holds everything

Every node of a cluster replicates every group. Each group has at most three voting members, which commit its writes, and every other node follows it as a learner, so adding nodes adds readers without slowing commits. When a voter stops, its group's leader promotes the caught-up learner enrolled longest, as Consul's autopilot does.

A request can reach any node:

- **A write** is forwarded to the leader of the group it changes, which commits it to a quorum of that group's voters before applying it on every node.
- **A current read** is served by the node it reaches, after checking with the group's leader that it has caught up, as Raft's ReadIndex does.
- **Nothing is answered before a quorum holds it.** Every reply, event, runner's job and log checkpoint waits until what it read is safe on a quorum, so no client ever sees a write the cluster could still lose. It waits only for the groups it read: the platform's, its organization's and its repositories', so a repository without its quorum holds back no other's answers.

Nodes authenticate one another with keys of their own, and the cluster's key, which seals every other key, lives only in their memory. See [Keys and the vault](https://docs.forge.workreef.dev/concepts/keys/).

## Storage

Each group's databases are Turso databases, replicated by shipping their transaction log over Raft, not their pages. The commits, trees and files of a repository live in its object store, a database of its own, so a node needs no separate blob service; an object larger than one Raft entry goes in chunks.

A cluster grows by adding nodes, which join it and take every group's data. Beyond one cluster, the design grows by adding clusters, each holding a set of organizations, as GitLab's Cells and AWS's cell-based architecture grow; that part is not built yet.

## Next

- [Keys and the vault](https://docs.forge.workreef.dev/concepts/keys/): how the cluster's key is kept and recovered.
- [`af-server`](https://docs.forge.workreef.dev/reference/af-server/) in the reference: starting a node, and joining one to a cluster.

Source: https://docs.forge.workreef.dev/concepts/architecture/index.mdx
