# Data model

> What is stored where.

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

For agents: Git data: bare repositories on disk (EFS or EBS per shard), path by repository id. Engine metadata (repos, users mapping, PRs, issues, reviews, protection) in Postgres (the engine's schema). Sypnia tables (schema sypnia_git): accounts (Sypnia user ↔ engine user), case_links (repo, kind commit|issue|pull, ref, case_id, cases_project), mirrors (repo, target, last_sync, state), imports/exports (job state, report), tokens (hash, scopes, expires), webhook_deliveries. S3: LFS objects, release assets, nightly git bundles + metadata dumps.

| Where                                                | What                                                                                                                                                                                                                       |
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Disk** (one bare repository per repository, by id) | the git data: objects, refs                                                                                                                                                                                                |
| **Postgres, engine schema**                          | repositories, pull requests, issues, reviews, branch rules, as the engine keeps them                                                                                                                                       |
| **Postgres, `sypnia_git` schema**                    | the link between Sypnia accounts and the engine's users; use-case links (commit, issue or pull request ↔ case); mirrors and their state; imports and exports with their reports; HTTPS tokens (hashed); webhook deliveries |
| **S3**                                               | Git LFS files, release files, nightly git bundles of every repository with a dump of its issues and pull requests                                                                                                          |

The nightly bundle is also what `export archive` gives you: your repository and its history as plain files.
