# andiswambonambi08/ronditrack architecture

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

- Interactive diagram: https://gitdiagram.com/andiswambonambi08/ronditrack
- Repository: https://github.com/andiswambonambi08/ronditrack

## Overview

RondiTrack is a Minimal API for stokvels (rotating savings groups). Its main workflow is to create users and stokvels, enroll eligible members, create a cycle, then record a member contribution with idempotency protection. Plain CRUD remains in endpoint handlers; cross-entity membership and contribution decisions run through StokvelService and domain rules. The graph also includes centralized validation and Problem Details handling. Endpoint details and the service workflow are supported by sampled source; the README documents user, cycle, mapping, and validation capabilities whose implementations were not all sampled.

Main entry points: [`Endpoints/StokvelEndpoints.cs`](https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/StokvelEndpoints.cs) (Stokvel routes), [`Endpoints/ContributionCycleEndpoints.cs`](https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/ContributionCycleEndpoints.cs) (Cycle routes), [`Services/StokvelService.cs`](https://github.com/andiswambonambi08/ronditrack/blob/main/Services/StokvelService.cs) (Stokvel service), [`Endpoints/UserEndpoints.cs`](https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/UserEndpoints.cs) (User routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_user_endpoints["User routes<br/>[UserEndpoints.cs]"]
  node_stokvel_endpoints["Stokvel routes"]
  node_cycle_endpoints["Cycle routes"]
  node_app["API composition<br/>[Program.cs]"]
end

subgraph group_logic["Business logic"]
  node_users["User domain<br/>[User.cs]"]
  node_stokvel["Stokvel rules<br/>[Stokvel.cs]"]
  node_cycle["Contribution cycle"]
  node_contribution["Contribution record<br/>[Contribution.cs]"]
  node_service["Stokvel service<br/>[StokvelService.cs]"]
end

subgraph group_state["In-memory state"]
  node_user_repo[("User repository")]
  node_stokvel_repo[("Stokvel repository")]
  node_cycle_repo[("Cycle repository")]
  node_idempotency[("Idempotency store")]
end

subgraph group_contracts["Contracts and errors"]
  node_validation["Request validation"]
  node_validators["Request validators"]
  node_dtos["HTTP DTOs"]
  node_mapping["DTO mapping"]
  node_exceptions["Domain exceptions"]
  node_error_handler["Problem responses"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_user_endpoints
node_client -->|"sends requests"| node_stokvel_endpoints
node_client -->|"sends requests"| node_cycle_endpoints
node_app -->|"maps routes"| node_user_endpoints
node_app -->|"maps routes"| node_stokvel_endpoints
node_app -->|"maps routes"| node_cycle_endpoints
node_user_endpoints -->|"validates input"| node_validation
node_stokvel_endpoints -->|"validates input"| node_validation
node_cycle_endpoints -->|"validates input"| node_validation
node_validation -->|"validates DTOs"| node_validators
node_user_endpoints -->|"CRUD access"| node_user_repo
node_stokvel_endpoints -->|"CRUD access"| node_stokvel_repo
node_cycle_endpoints -->|"CRUD access"| node_cycle_repo
node_stokvel_endpoints -->|"delegates decisions"| node_service
node_service -->|"reads stokvels"| node_stokvel_repo
node_service -->|"reads users"| node_user_repo
node_service -->|"reads cycles"| node_cycle_repo
node_service -->|"checks and saves"| node_idempotency
node_service -->|"enforces rules"| node_stokvel
node_stokvel -->|"checks activity"| node_users
node_stokvel -->|"records contribution"| node_contribution
node_cycle_endpoints -->|"checks parent"| node_stokvel_repo
node_user_endpoints -->|"maps responses"| node_mapping
node_stokvel_endpoints -->|"maps responses"| node_mapping
node_cycle_endpoints -->|"maps responses"| node_mapping
node_mapping -->|"produces responses"| node_dtos
node_user_endpoints -->|"binds requests"| node_dtos
node_stokvel_endpoints -->|"binds requests"| node_dtos
node_cycle_endpoints -->|"binds requests"| node_dtos
node_error_handler -->|"maps failures"| node_exceptions
node_app -->|"handles exceptions"| node_error_handler

click node_user_endpoints "https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/UserEndpoints.cs"
click node_stokvel_endpoints "https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/StokvelEndpoints.cs"
click node_cycle_endpoints "https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/ContributionCycleEndpoints.cs"
click node_users "https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/User.cs"
click node_stokvel "https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/Stokvel.cs"
click node_cycle "https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/ContributionCycle.cs"
click node_contribution "https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/Contribution.cs"
click node_service "https://github.com/andiswambonambi08/ronditrack/blob/main/Services/StokvelService.cs"
click node_user_repo "https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryUserRepository.cs"
click node_stokvel_repo "https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryStokvelRepository.cs"
click node_cycle_repo "https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryContributionCycleRepository.cs"
click node_idempotency "https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryIdempotencyStore.cs"
click node_validation "https://github.com/andiswambonambi08/ronditrack/blob/main/Validation/ValidationFilter.cs"
click node_validators "https://github.com/andiswambonambi08/ronditrack/tree/main/Validation/Validators"
click node_dtos "https://github.com/andiswambonambi08/ronditrack/tree/main/Dtos"
click node_mapping "https://github.com/andiswambonambi08/ronditrack/tree/main/Mapping"
click node_exceptions "https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/Exceptions/DomainExceptions.cs"
click node_error_handler "https://github.com/andiswambonambi08/ronditrack/blob/main/ErrorHandling/RondiTrackExceptionHandler.cs"
click node_app "https://github.com/andiswambonambi08/ronditrack/blob/main/Program.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_user_endpoints,node_stokvel_endpoints,node_cycle_endpoints,node_app,node_client toneBlue
class node_users,node_stokvel,node_cycle,node_contribution,node_service toneAmber
class node_user_repo,node_stokvel_repo,node_cycle_repo,node_idempotency toneMint
class node_validation,node_validators,node_dtos,node_mapping,node_exceptions,node_error_handler toneRose
```

## Components

### HTTP API

- [User routes](https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/UserEndpoints.cs): `Endpoints/UserEndpoints.cs`
- [Stokvel routes](https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/StokvelEndpoints.cs): `Endpoints/StokvelEndpoints.cs`
- [Cycle routes](https://github.com/andiswambonambi08/ronditrack/blob/main/Endpoints/ContributionCycleEndpoints.cs): `Endpoints/ContributionCycleEndpoints.cs`
- [API composition](https://github.com/andiswambonambi08/ronditrack/blob/main/Program.cs): `Program.cs`

### Business logic

- [User domain](https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/User.cs): `Domain/User.cs`
- [Stokvel rules](https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/Stokvel.cs): `Domain/Stokvel.cs`
- [Contribution cycle](https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/ContributionCycle.cs): `Domain/ContributionCycle.cs`
- [Contribution record](https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/Contribution.cs): `Domain/Contribution.cs`
- [Stokvel service](https://github.com/andiswambonambi08/ronditrack/blob/main/Services/StokvelService.cs): `Services/StokvelService.cs`

### In-memory state

- [User repository](https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryUserRepository.cs): `Data/InMemoryUserRepository.cs`
- [Stokvel repository](https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryStokvelRepository.cs): `Data/InMemoryStokvelRepository.cs`
- [Cycle repository](https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryContributionCycleRepository.cs): `Data/InMemoryContributionCycleRepository.cs`
- [Idempotency store](https://github.com/andiswambonambi08/ronditrack/blob/main/Data/InMemoryIdempotencyStore.cs): `Data/InMemoryIdempotencyStore.cs`

### Contracts and errors

- [Request validation](https://github.com/andiswambonambi08/ronditrack/blob/main/Validation/ValidationFilter.cs): `Validation/ValidationFilter.cs`
- [Request validators](https://github.com/andiswambonambi08/ronditrack/tree/main/Validation/Validators): `Validation/Validators`
- [HTTP DTOs](https://github.com/andiswambonambi08/ronditrack/tree/main/Dtos): `Dtos`
- [DTO mapping](https://github.com/andiswambonambi08/ronditrack/tree/main/Mapping): `Mapping`
- [Domain exceptions](https://github.com/andiswambonambi08/ronditrack/blob/main/Domain/Exceptions/DomainExceptions.cs): `Domain/Exceptions/DomainExceptions.cs`
- [Problem responses](https://github.com/andiswambonambi08/ronditrack/blob/main/ErrorHandling/RondiTrackExceptionHandler.cs): `ErrorHandling/RondiTrackExceptionHandler.cs`

### Other components

- **API client**

## Connections

- API client → User routes: sends requests
- API client → Stokvel routes: sends requests
- API client → Cycle routes: sends requests
- API composition → User routes: maps routes
- API composition → Stokvel routes: maps routes
- API composition → Cycle routes: maps routes
- User routes → Request validation: validates input
- Stokvel routes → Request validation: validates input
- Cycle routes → Request validation: validates input
- Request validation → Request validators: validates DTOs
- User routes → User repository: CRUD access
- Stokvel routes → Stokvel repository: CRUD access
- Cycle routes → Cycle repository: CRUD access
- Stokvel routes → Stokvel service: delegates decisions
- Stokvel service → Stokvel repository: reads stokvels
- Stokvel service → User repository: reads users
- Stokvel service → Cycle repository: reads cycles
- Stokvel service → Idempotency store: checks and saves
- Stokvel service → Stokvel rules: enforces rules
- Stokvel rules → User domain: checks activity
- Stokvel rules → Contribution record: records contribution
- Cycle routes → Stokvel repository: checks parent
- User routes → DTO mapping: maps responses
- Stokvel routes → DTO mapping: maps responses
- Cycle routes → DTO mapping: maps responses
- DTO mapping → HTTP DTOs: produces responses
- User routes → HTTP DTOs: binds requests
- Stokvel routes → HTTP DTOs: binds requests
- Cycle routes → HTTP DTOs: binds requests
- Problem responses → Domain exceptions: maps failures
- API composition → Problem responses: handles exceptions
