# Architecture

> How Sypnia Cases is built, where each part runs, and how a request moves through it.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://cases.docs.sypnia.com/architecture/

For agents: Cases components: @sypnia/cases (TS: Sypnorm ORM and runners, map derivation, spec, validator, client, CLI), the Cases server (TypeScript on Node; API, proposals, versions, checks; storage in Postgres through Sypnia Data with Sypnorm use cases), the editor (Vite + React SPA, Sypnia Cloud), the link readers (read-only clients of Data, Telemetry, Git, Agent APIs), the MCP server (same server, /mcp on mcp.cases.sypnia.com). The runtime: in @sypnia/cases (TS area services) and the sypnia-cases crate (Rust services, tokio delivery task); delivery on AWS via EventBridge + SQS per listener, set up by Run; on Postgres alone via LISTEN/NOTIFY and the deliveries table. Pages: request-paths, data-model, aws, failures, codebase.

**Figure**: Sypnia Cases. The format and its tools are open; the server stores maps, versions and proposals in Postgres; the editor and the link readers are clients of it.

1. People use the editor; agents use MCP; CI uses the CLI.
2. The Cases server owns maps, versions, proposals, comments and checks.
3. Its state lives in Postgres, through Sypnia Data.
4. The link readers ask Data, Telemetry, Git and Agent, with the member's own token.
5. Repositories hold the same map as files.

## The parts

| Part                          | What it does                                                                                                                                                                                                                                    | Runs as                                                       | Open source                       |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | --------------------------------- |
| `@sypnia/cases`               | Sypnorm (the use-case ORM and its runners), the runtime inside each area's service (outbox, background delivery task, loop guard), deriving the map from code, the format's types and schemas, parser, validator, diff, the API client, the CLI | TypeScript, in your app, your terminal and CI                 | yes, MIT                          |
| **The Cases server**          | the API: maps, versions, proposals, comments, checks, sync with repositories                                                                                                                                                                    | TypeScript on Node; one process, stateless                    | yes, AGPL-3.0                     |
| **Storage**                   | maps, versions, proposals, comments, audit                                                                                                                                                                                                      | Postgres, with Sypnia Data and Sypnorm                        | your Postgres                     |
| **The editor** **\[Cloud]**   | the visual map, the reviews                                                                                                                                                                                                                     | a static web app (Vite + React)                               | no                                |
| **Link readers** **\[Cloud]** | read tables, health, commits, tasks from the other products                                                                                                                                                                                     | inside the server, with the member's token                    | yes, AGPL-3.0, part of the server |
| **MCP**                       | the tools for agents                                                                                                                                                                                                                            | inside the server, at `mcp.cases.sypnia.com`                  | yes, AGPL-3.0, part of the server |
| **`sypnia-cases` crate**      | the same runtime for services written in Rust, such as Telemetry's engine: outbox rows, the tokio delivery task, idempotency                                                                                                                    | Rust, inside your service                                     | yes, MIT                          |
| **Delivery on AWS**           | the bus, the queue per listener and its dead letters                                                                                                                                                                                            | Amazon EventBridge and SQS, set up by Sypnia Run from the map | the template, yes                 |

## Which language where

Sypnia's engines that sit on a hot path (Telemetry's ingestion, Data's API) are Rust. The Cases server is not on a hot path: a map has hundreds of cases, not millions of events, and checks run in CI where the code is, so it is TypeScript, one language with Sypnorm and the editor. The runtime lives where your code lives: in `@sypnia/cases` for TypeScript services, and in the `sypnia-cases` crate for Rust services, both writing the same outbox and the same events.
