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

# Architecture

> CLI/MCP/dashboard → HTTP server → engine → adapter → Docker.

* **engine** (`src/engine.ts`): project and branch lifecycle, from provision through clone (`pg_dump` → restore, `rclone sync`, app redeploys) to teardown with compensation on failure.
* **govern** (`src/govern.ts`): the policy engine — 12 gated actions, allow/deny/approve per project, one-shot grants, HTTP 202 approval flow.
* **adapters** (`src/adapters/`): `LocalPostgres` (a container per branch), `LocalGarage` (one shared S3 server; a bucket + bucket-scoped key per branch), `DockerCompute` (your image per compute group), `LocalManagedDb` (private Redis/MySQL/MongoDB per branch). `RailwayCompute` (`INSTA_OSS_COMPUTE=railway`) runs compute on Railway instead.
* **state** (`src/state.ts`): a single JSON file, `~/.insta-oss/state.json`.
