# abdullah-albayati/temporaldb architecture

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

- Interactive diagram: https://gitdiagram.com/abdullah-albayati/temporaldb
- Repository: https://github.com/abdullah-albayati/temporaldb

## Overview

TemporalDB is a lightweight .NET temporal database engine: records retain version and validity intervals, and the in-memory repository saves versions and exposes date-based and history retrieval. Queries can combine an as-of time with a data predicate; QueryBuilder applies those constraints to supplied records. The sampled API only serves a weather-forecast example, and the CLI is a placeholder, so neither is shown as a product entry point. No sampled code wires the repository to the query engine or to a user-facing application; dashed edges mark that unverified usage.

Main entry points: [`src/TemporalDB.Storage/InMemoryTemporalRepository.cs`](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Storage/InMemoryTemporalRepository.cs) (In-Memory Repository), [`src/TemporalDB.QueryEngine/QueryBuilder.cs`](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.QueryEngine/QueryBuilder.cs) (Query Executor), [`src/TemporalDB.Core/Models/TemporalRecord.cs`](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Core/Models/TemporalRecord.cs) (Temporal Record), [`src/TemporalDB.Core/Abstractions/TemporalRecordAbstraction.cs`](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Core/Abstractions/TemporalRecordAbstraction.cs) (Repository Contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Temporal Core"]
  node_record["Temporal Record<br/>[TemporalRecord.cs]"]
  node_repository_contract["Repository Contract"]
end

subgraph group_storage["Temporal Storage"]
  node_memory_repo[("In-Memory Repository")]
end

subgraph group_query["Query Engine"]
  node_query_spec["Query Specification<br/>[Query.cs]"]
  node_query_builder["Query Executor<br/>[QueryBuilder.cs]"]
end

node_user(("Database User"))

node_repository_contract -->|"accepts records"| node_record
node_memory_repo -->|"implements"| node_repository_contract
node_memory_repo -->|"stores versions"| node_record
node_query_builder -->|"reads query"| node_query_spec
node_query_builder -->|"filters records"| node_record
node_user -.->|"saves and retrieves"| node_memory_repo
node_user -.->|"executes queries"| node_query_builder

click node_record "https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Core/Models/TemporalRecord.cs"
click node_repository_contract "https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Core/Abstractions/TemporalRecordAbstraction.cs"
click node_memory_repo "https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Storage/InMemoryTemporalRepository.cs"
click node_query_spec "https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.QueryEngine/Query.cs"
click node_query_builder "https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.QueryEngine/QueryBuilder.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_record,node_repository_contract toneBlue
class node_memory_repo,node_user toneAmber
class node_query_spec,node_query_builder toneMint
```

## Components

### Temporal Core

- [Temporal Record](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Core/Models/TemporalRecord.cs): `src/TemporalDB.Core/Models/TemporalRecord.cs`
- [Repository Contract](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Core/Abstractions/TemporalRecordAbstraction.cs): `src/TemporalDB.Core/Abstractions/TemporalRecordAbstraction.cs`

### Temporal Storage

- [In-Memory Repository](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.Storage/InMemoryTemporalRepository.cs): `src/TemporalDB.Storage/InMemoryTemporalRepository.cs`

### Query Engine

- [Query Specification](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.QueryEngine/Query.cs): `src/TemporalDB.QueryEngine/Query.cs`
- [Query Executor](https://github.com/abdullah-albayati/temporaldb/blob/main/src/TemporalDB.QueryEngine/QueryBuilder.cs): `src/TemporalDB.QueryEngine/QueryBuilder.cs`

### Other components

- **Database User**

## Connections

- Repository Contract → Temporal Record: accepts records (evidence: `src/TemporalDB.Core/Abstractions/TemporalRecordAbstraction.cs`)
- In-Memory Repository → Repository Contract: implements (evidence: `src/TemporalDB.Storage/InMemoryTemporalRepository.cs`)
- In-Memory Repository → Temporal Record: stores versions (evidence: `src/TemporalDB.Storage/InMemoryTemporalRepository.cs`)
- Query Executor → Query Specification: reads query (evidence: `src/TemporalDB.QueryEngine/QueryBuilder.cs`)
- Query Executor → Temporal Record: filters records (evidence: `src/TemporalDB.QueryEngine/QueryBuilder.cs`)
- Database User → In-Memory Repository: saves and retrieves
- Database User → Query Executor: executes queries
