# michaelatsey/mini-ged architecture

> Architecture diagram of the GitHub repository michaelatsey/mini-ged, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/michaelatsey/mini-ged
- Repository: https://github.com/michaelatsey/mini-ged
- Video tour (about a minute): https://gitdiagram.com/michaelatsey/mini-ged/video

## Overview

mini-ged is a document-management platform built around versioned documents whose immutable content is stored separately as digest-addressed blobs. The main workflow accepts an upload through the API, validates and detects its format, writes content to object storage, and commits document/blob state; downloads resolve the document’s current version back to stored content. Other branches manage folders, document lifecycle, storage migration and orphan cleanup. The tree and excerpts show the principal boundaries; some feature wiring and persistence details are documented rather than sampled, so those relationships cite the README.

Main entry points: [`src/Ged.Features/Documents`](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Documents) (Document slices), [`hosts/Ged.Api/Program.cs`](https://github.com/michaelatsey/mini-ged/blob/main/hosts/Ged.Api/Program.cs) (Versioned API), [`src/Ged.Adapters.Storage/ObjectStorageRegistry.cs`](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Storage/ObjectStorageRegistry.cs) (Storage registry), [`src/Ged.Features/Folders`](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Folders) (Folder slices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and features"]
  node_api["Versioned API<br/>[Program.cs]"]
  node_docflows["Document slices<br/>[Documents]"]
  node_folderflows["Folder slices<br/>[Folders]"]
  node_uploadpolicy["Upload policy<br/>[FileTypes]"]
  node_detector["Format detection"]
  node_jobs["Blob jobs<br/>[Jobs]"]
end

subgraph group_domain["Domain model"]
  node_document["Document aggregate<br/>[Document.cs]"]
  node_folder["Folder aggregate<br/>[Folder.cs]"]
  node_blob["Blob aggregate<br/>[Blob.cs]"]
end

subgraph group_storage["Content and storage"]
  node_registry["Storage registry"]
  node_storageport["Object storage port<br/>[IObjectStorage.cs]"]
  node_filesystem["Filesystem adapter"]
end

subgraph group_persistence["Persistence"]
  node_database[("GED database")]
  node_dbcontext["Write context<br/>[GedDbContext.cs]"]
  node_repositories["Aggregate repositories<br/>[Repositories]"]
  node_sqlreads["SQL read handlers<br/>[Ged.Features]"]
  node_outbox["Outbox<br/>[Outbox]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_api
node_api -->|"maps endpoints"| node_docflows
node_api -->|"maps endpoints"| node_folderflows
node_docflows -->|"checks upload"| node_uploadpolicy
node_uploadpolicy -->|"requests detection"| node_detector
node_docflows -->|"stores and reads"| node_registry
node_docflows -->|"mutates aggregate"| node_document
node_docflows -->|"tracks content"| node_blob
node_folderflows -->|"mutates aggregate"| node_folder
node_docflows -->|"writes transactionally"| node_repositories
node_folderflows -->|"writes transactionally"| node_repositories
node_docflows -->|"queries SQL"| node_sqlreads
node_sqlreads -->|"reads projections"| node_database
node_repositories -->|"persist aggregates"| node_dbcontext
node_dbcontext -->|"reads and writes"| node_database
node_dbcontext -->|"stores messages"| node_outbox
node_docflows -.->|"records domain events"| node_outbox
node_jobs -->|"reconciles storage"| node_registry
node_jobs -->|"checks blob state"| node_database
node_registry -->|"resolves adapter"| node_storageport
node_filesystem -->|"implements port"| node_storageport
node_storageport -.->|"locations stored separately"| node_database
node_api -->|"registers storage"| node_registry

click node_api "https://github.com/michaelatsey/mini-ged/blob/main/hosts/Ged.Api/Program.cs"
click node_docflows "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Documents"
click node_folderflows "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Folders"
click node_uploadpolicy "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Common/FileTypes"
click node_detector "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Core/Ports/FileTypes/IContentFormatDetector.cs"
click node_jobs "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Blobs/Jobs"
click node_document "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Domain/Documents/Document.cs"
click node_folder "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Domain/Folders/Folder.cs"
click node_blob "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Domain/Blobs/Blob.cs"
click node_registry "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Storage/ObjectStorageRegistry.cs"
click node_storageport "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Core/Ports/IObjectStorage.cs"
click node_filesystem "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Storage.FileSystem/FileSystemObjectStorage.cs"
click node_dbcontext "https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Persistence/GedDbContext.cs"
click node_repositories "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Adapters.Persistence/Repositories"
click node_sqlreads "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features"
click node_outbox "https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Adapters.Persistence/Outbox"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_docflows,node_folderflows,node_uploadpolicy,node_detector,node_jobs,node_client toneBlue
class node_document,node_folder,node_blob toneAmber
class node_registry,node_storageport,node_filesystem toneMint
class node_database,node_dbcontext,node_repositories,node_sqlreads,node_outbox toneRose
```

## Components

### API and features

- [Versioned API](https://github.com/michaelatsey/mini-ged/blob/main/hosts/Ged.Api/Program.cs): `hosts/Ged.Api/Program.cs`
- [Document slices](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Documents): `src/Ged.Features/Documents`
- [Folder slices](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Folders): `src/Ged.Features/Folders`
- [Upload policy](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Common/FileTypes): `src/Ged.Features/Common/FileTypes`
- [Format detection](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Core/Ports/FileTypes/IContentFormatDetector.cs): `src/Ged.Core/Ports/FileTypes/IContentFormatDetector.cs`
- [Blob jobs](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features/Blobs/Jobs): `src/Ged.Features/Blobs/Jobs`

### Domain model

- [Document aggregate](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Domain/Documents/Document.cs): `src/Ged.Domain/Documents/Document.cs`
- [Folder aggregate](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Domain/Folders/Folder.cs): `src/Ged.Domain/Folders/Folder.cs`
- [Blob aggregate](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Domain/Blobs/Blob.cs): `src/Ged.Domain/Blobs/Blob.cs`

### Content and storage

- [Storage registry](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Storage/ObjectStorageRegistry.cs): `src/Ged.Adapters.Storage/ObjectStorageRegistry.cs`
- [Object storage port](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Core/Ports/IObjectStorage.cs): `src/Ged.Core/Ports/IObjectStorage.cs`
- [Filesystem adapter](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Storage.FileSystem/FileSystemObjectStorage.cs): `src/Ged.Adapters.Storage.FileSystem/FileSystemObjectStorage.cs`

### Persistence

- **GED database**
- [Write context](https://github.com/michaelatsey/mini-ged/blob/main/src/Ged.Adapters.Persistence/GedDbContext.cs): `src/Ged.Adapters.Persistence/GedDbContext.cs`
- [Aggregate repositories](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Adapters.Persistence/Repositories): `src/Ged.Adapters.Persistence/Repositories`
- [SQL read handlers](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Features): `src/Ged.Features`
- [Outbox](https://github.com/michaelatsey/mini-ged/tree/main/src/Ged.Adapters.Persistence/Outbox): `src/Ged.Adapters.Persistence/Outbox`

### Other components

- **API client**

## Connections

- API client → Versioned API: sends requests (evidence: `hosts/Ged.Api/Program.cs`)
- Versioned API → Document slices: maps endpoints (evidence: `README.md`)
- Versioned API → Folder slices: maps endpoints (evidence: `README.md`)
- Document slices → Upload policy: checks upload (evidence: `README.md`)
- Upload policy → Format detection: requests detection (evidence: `README.md`)
- Document slices → Storage registry: stores and reads (evidence: `src/Ged.Features/Documents/UploadDocument/UploadDocumentHandler.cs`)
- Document slices → Document aggregate: mutates aggregate (evidence: `src/Ged.Features/Documents/UploadDocument/UploadDocumentHandler.cs`)
- Document slices → Blob aggregate: tracks content (evidence: `src/Ged.Features/Documents/UploadDocument/UploadDocumentHandler.cs`)
- Folder slices → Folder aggregate: mutates aggregate (evidence: `README.md`)
- Document slices → Aggregate repositories: writes transactionally (evidence: `README.md`)
- Folder slices → Aggregate repositories: writes transactionally (evidence: `README.md`)
- Document slices → SQL read handlers: queries SQL (evidence: `README.md`)
- SQL read handlers → GED database: reads projections (evidence: `README.md`)
- Aggregate repositories → Write context: persist aggregates (evidence: `src/Ged.Adapters.Persistence/Repositories/EfFolderRepository.cs`)
- Write context → GED database: reads and writes (evidence: `src/Ged.Adapters.Persistence/GedDbContext.cs`)
- Write context → Outbox: stores messages (evidence: `src/Ged.Adapters.Persistence/GedDbContext.cs`)
- Document slices → Outbox: records domain events
- Blob jobs → Storage registry: reconciles storage (evidence: `src/Ged.Features/Blobs/Jobs/ReconcileStorageJob.cs`)
- Blob jobs → GED database: checks blob state (evidence: `README.md`)
- Storage registry → Object storage port: resolves adapter (evidence: `src/Ged.Adapters.Storage/ObjectStorageRegistry.cs`)
- Filesystem adapter → Object storage port: implements port (evidence: `src/Ged.Adapters.Storage.FileSystem/FileSystemObjectStorage.cs`)
- Object storage port → GED database: locations stored separately
- Versioned API → Storage registry: registers storage (evidence: `hosts/Ged.Api/Program.cs`)
