# Architecture

> How Sypnia Files is built: its parts, where Rust runs, and how they connect.

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

For agents: Files architecture: one Rust binary (axum; libvips) with auth, object API, tus server, S3 gateway, image transformer, MCP; metadata and policies in Postgres (sypnia_files), bytes in S3-compatible storage; content host behind CDN serves public files and transforms and checks signed URLs; @sypnia/files TypeScript; console private.

**Figure**: Sypnia Files: the API and the content edge, the engine's modules, and where metadata and bytes live.

1. Your app or a tool calls the Files API with a token, a key or S3 signatures.
2. The engine checks the token and runs the policy in Postgres.
3. Metadata goes to `sypnia_files` in Postgres; bytes go to S3-compatible storage.
4. Visitors get files and transforms from the content host through the CDN.

Apps, S3 tools and agents call the Files API. The engine is one Rust binary with an auth module, the object API, the tus upload server, the S3 gateway, the image transformer and the MCP server. It keeps metadata and policies in Postgres and bytes in S3-compatible storage. The content host, behind the CDN, serves public files and image transforms and checks signed URLs.

| Part                                                | Language                                                  | Open source     |
| --------------------------------------------------- | --------------------------------------------------------- | --------------- |
| Files engine: API, tus, S3 gateway, transforms, MCP | Rust (axum, libvips for images)                           | yes             |
| `@sypnia/files`                                     | TypeScript                                                | yes             |
| Content edge in Sypnia Cloud                        | CloudFront + Lambda running the engine's transform module | the module, yes |
| Console                                             | TypeScript (React)                                        | no              |

- [Request paths](/architecture/request-paths/): An upload, a private download and an image transform, call by call.
- [Data model](/architecture/data-model/): The sypnia_files schema: buckets, objects, uploads in progress, S3 keys and the functions policies use.
- [Reference implementation on AWS](/architecture/reference-implementation-aws/): Every AWS service Files uses in Sypnia Cloud, and how.
- [Failures and scaling](/architecture/failures-and-scaling/): What happens when storage, the database or scanning fails, and how Files grows.
- [Codebase](/architecture/codebase/): How the open-source repository is organized.
