# kiarashminoo/thunderpropagator.recoveryhandlers architecture

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

- Interactive diagram: https://gitdiagram.com/kiarashminoo/thunderpropagator.recoveryhandlers
- Repository: https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers

## Overview

This repository provides pluggable snapshot-recovery storage backends for ThunderPropagator: applications register a backend, its factory selects it from channel metadata and feature gates, and the resulting handler backs up, restores, hibernates, or cleans up snapshots in MongoDB, PostgreSQL, or Redis. PostgreSQL also initializes its schema and maps snapshot values to and from stored types. The shared-kernel capability is preserved as documented, but its implementation excerpt does not establish runtime links. Edges are limited to relationships shown in the README or sampled source and SOURCE INDEX.

Main entry points: [`src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.cs`](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.cs) (PostgreSQL recovery), [`src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs`](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs) (PostgreSQL handler factory), [`src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs`](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs) (Mongo recovery), [`src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs`](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs) (Snapshot backup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_registration["Registration and dispatch"]
  node_mongo_registration["Mongo registration"]
  node_mongo_factory["Mongo handler factory"]
  node_pg_registration["PostgreSQL registration"]
  node_pg_factory["PostgreSQL handler factory"]
  node_redis_registration["Redis registration"]
  node_redis_factory["Redis handler factory"]
end

subgraph group_mongodb["MongoDB backend"]
  node_mongo_handler["Mongo recovery"]
  node_mongo_cache["Mongo client cache"]
  node_mongodb_store[("MongoDB")]
end

subgraph group_postgresql["PostgreSQL backend"]
  node_pg_handler["PostgreSQL recovery"]
  node_pg_setup["Database setup"]
  node_pg_backup["Snapshot backup"]
  node_pg_restore["Snapshot restore"]
  node_pg_cleanup["Snapshot cleanup"]
  node_pg_hibernate["Snapshot hibernation"]
  node_pg_mapper["Snapshot type mapper"]
  node_postgresql_store[("PostgreSQL")]
end

subgraph group_redis["Redis backend"]
  node_redis_handler["Redis recovery"]
  node_redis_cache["Redis connection cache"]
  node_redis_store[("Redis")]
end

subgraph group_shared["Shared kernel"]
  node_shared_kernel["Shared kernel extensions"]
end

node_application(("ThunderPropagator app"))

node_application -->|"registers"| node_mongo_registration
node_application -->|"registers"| node_pg_registration
node_application -->|"registers"| node_redis_registration
node_mongo_registration -->|"registers factory"| node_mongo_factory
node_pg_registration -->|"registers factory"| node_pg_factory
node_redis_registration -->|"registers factory"| node_redis_factory
node_mongo_factory -->|"creates"| node_mongo_handler
node_pg_factory -->|"creates"| node_pg_handler
node_redis_factory -->|"creates"| node_redis_handler
node_mongo_handler -->|"gets client"| node_mongo_cache
node_mongo_handler -->|"reads and writes"| node_mongodb_store
node_pg_factory -->|"selects by metadata"| node_pg_handler
node_pg_handler -->|"initializes via"| node_pg_setup
node_pg_handler -->|"backs up via"| node_pg_backup
node_pg_handler -->|"restores via"| node_pg_restore
node_pg_handler -->|"cleans via"| node_pg_cleanup
node_pg_handler -->|"hibernates via"| node_pg_hibernate
node_pg_restore -->|"deserializes with"| node_pg_mapper
node_pg_backup -->|"serializes with"| node_pg_mapper
node_pg_setup -->|"creates schema"| node_postgresql_store
node_pg_backup -->|"writes snapshots"| node_postgresql_store
node_pg_restore -->|"reads snapshots"| node_postgresql_store
node_pg_cleanup -->|"deletes snapshots"| node_postgresql_store
node_pg_hibernate -->|"updates snapshots"| node_postgresql_store
node_redis_handler -->|"connects via"| node_redis_cache
node_redis_handler -->|"reads and writes"| node_redis_store

click node_mongo_registration "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerExtensions.cs"
click node_mongo_factory "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerFactory.cs"
click node_mongo_handler "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs"
click node_mongo_cache "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoClientCache.cs"
click node_pg_registration "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerExtensions.cs"
click node_pg_factory "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs"
click node_pg_handler "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.cs"
click node_pg_setup "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.DatabaseSetup.cs"
click node_pg_backup "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs"
click node_pg_restore "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Restore.cs"
click node_pg_cleanup "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Cleanup.cs"
click node_pg_hibernate "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Hibernate.cs"
click node_pg_mapper "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlSnapshotTypeMapper.cs"
click node_redis_registration "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerExtensions.cs"
click node_redis_factory "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerFactory.cs"
click node_redis_handler "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandler.cs"
click node_redis_cache "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisConnectionMultiplexerCache.cs"
click node_shared_kernel "https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.SharedKernel/ThunderPropagatorExtensions.cs"

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_mongo_registration,node_mongo_factory,node_pg_registration,node_pg_factory,node_redis_registration,node_redis_factory toneBlue
class node_mongo_handler,node_mongo_cache,node_mongodb_store toneAmber
class node_pg_handler,node_pg_setup,node_pg_backup,node_pg_restore,node_pg_cleanup,node_pg_hibernate,node_pg_mapper,node_postgresql_store toneMint
class node_redis_handler,node_redis_cache,node_redis_store toneRose
class node_shared_kernel,node_application toneIndigo
```

## Components

### Registration and dispatch

- [Mongo registration](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerExtensions.cs): `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerExtensions.cs`
- [Mongo handler factory](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerFactory.cs): `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerFactory.cs`
- [PostgreSQL registration](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerExtensions.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerExtensions.cs`
- [PostgreSQL handler factory](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs`
- [Redis registration](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerExtensions.cs): `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerExtensions.cs`
- [Redis handler factory](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerFactory.cs): `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerFactory.cs`

### MongoDB backend

- [Mongo recovery](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs): `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs`
- [Mongo client cache](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.MongoDb/MongoClientCache.cs): `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoClientCache.cs`
- **MongoDB**

### PostgreSQL backend

- [PostgreSQL recovery](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.cs`
- [Database setup](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.DatabaseSetup.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.DatabaseSetup.cs`
- [Snapshot backup](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs`
- [Snapshot restore](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Restore.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Restore.cs`
- [Snapshot cleanup](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Cleanup.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Cleanup.cs`
- [Snapshot hibernation](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Hibernate.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Hibernate.cs`
- [Snapshot type mapper](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlSnapshotTypeMapper.cs): `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlSnapshotTypeMapper.cs`
- **PostgreSQL**

### Redis backend

- [Redis recovery](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandler.cs): `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandler.cs`
- [Redis connection cache](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.Redis/RedisConnectionMultiplexerCache.cs): `src/ThunderPropagator.RecoveryHandler.Redis/RedisConnectionMultiplexerCache.cs`
- **Redis**

### Shared kernel

- [Shared kernel extensions](https://github.com/kiarashminoo/thunderpropagator.recoveryhandlers/blob/develop/src/ThunderPropagator.RecoveryHandler.SharedKernel/ThunderPropagatorExtensions.cs): `src/ThunderPropagator.RecoveryHandler.SharedKernel/ThunderPropagatorExtensions.cs`

### Other components

- **ThunderPropagator app**

## Connections

- ThunderPropagator app → Mongo registration: registers (evidence: `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerExtensions.cs`)
- ThunderPropagator app → PostgreSQL registration: registers (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerExtensions.cs`)
- ThunderPropagator app → Redis registration: registers (evidence: `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerExtensions.cs`)
- Mongo registration → Mongo handler factory: registers factory (evidence: `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerExtensions.cs`)
- PostgreSQL registration → PostgreSQL handler factory: registers factory (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerExtensions.cs`)
- Redis registration → Redis handler factory: registers factory (evidence: `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerExtensions.cs`)
- Mongo handler factory → Mongo recovery: creates (evidence: `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandlerFactory.cs`)
- PostgreSQL handler factory → PostgreSQL recovery: creates (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs`)
- Redis handler factory → Redis recovery: creates (evidence: `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandlerFactory.cs`)
- Mongo recovery → Mongo client cache: gets client (evidence: `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs`)
- Mongo recovery → MongoDB: reads and writes (evidence: `src/ThunderPropagator.RecoveryHandler.MongoDb/MongoDbRecoveryHandler.cs`)
- PostgreSQL handler factory → PostgreSQL recovery: selects by metadata (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandlerFactory.cs`)
- PostgreSQL recovery → Database setup: initializes via (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.DatabaseSetup.cs`)
- PostgreSQL recovery → Snapshot backup: backs up via (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs`)
- PostgreSQL recovery → Snapshot restore: restores via (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Restore.cs`)
- PostgreSQL recovery → Snapshot cleanup: cleans via (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Cleanup.cs`)
- PostgreSQL recovery → Snapshot hibernation: hibernates via (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Hibernate.cs`)
- Snapshot restore → Snapshot type mapper: deserializes with (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Restore.cs`)
- Snapshot backup → Snapshot type mapper: serializes with (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs`)
- Database setup → PostgreSQL: creates schema (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.DatabaseSetup.cs`)
- Snapshot backup → PostgreSQL: writes snapshots (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Backup.cs`)
- Snapshot restore → PostgreSQL: reads snapshots (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Restore.cs`)
- Snapshot cleanup → PostgreSQL: deletes snapshots (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Cleanup.cs`)
- Snapshot hibernation → PostgreSQL: updates snapshots (evidence: `src/ThunderPropagator.RecoveryHandler.Postgresql/PostgresqlRecoveryHandler.Hibernate.cs`)
- Redis recovery → Redis connection cache: connects via (evidence: `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandler.cs`)
- Redis recovery → Redis: reads and writes (evidence: `src/ThunderPropagator.RecoveryHandler.Redis/RedisRecoveryHandler.cs`)
