# naimlawani01/kobiri architecture

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

- Interactive diagram: https://gitdiagram.com/naimlawani01/kobiri
- Repository: https://github.com/naimlawani01/kobiri

## Overview

Kobiri est un backend FastAPI de gestion de tontines. Le parcours principal va de l’inscription et de l’adhésion à une tontine, à la planification des cotisations, leur paiement et validation, puis au suivi des tours et versements. Les notifications complètent ce parcours. Le graphe distingue les routes, les domaines métier et la persistance. Les liens entre routes et modèles s’appuient sur l’index des références; les intégrations mobiles sont documentées, mais leur câblage interne n’est pas établi par les extraits.

Main entry points: [`app/api/v1/router.py`](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/router.py) (Routeur v1), [`app/database.py`](https://github.com/naimlawani01/kobiri/blob/main/app/database.py) (Sessions SQLAlchemy), [`app/api/v1/endpoints/payments.py`](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/payments.py) (Paiements), [`app/api/v1/endpoints/notifications.py`](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/notifications.py) (Notifications API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API et accès"]
  node_api_entry["Application API<br/>[main.py]"]
  node_router["Routeur v1<br/>[router.py]"]
  node_auth["Authentification<br/>[auth.py]"]
end

subgraph group_community["Comptes et tontines"]
  node_users["Gestion utilisateurs<br/>[users.py]"]
  node_user_model["Comptes et rôles<br/>[user.py]"]
  node_tontines["Gestion tontines<br/>[tontines.py]"]
  node_tontine_model["Groupes et règles<br/>[tontine.py]"]
end

subgraph group_contributions["Cotisations et tours"]
  node_session_api["Sessions cotisation<br/>[sessions.py]"]
  node_session_model["Cycles de collecte<br/>[session.py]"]
  node_payments["Paiements<br/>[payments.py]"]
  node_payment_model["Enregistrements paiement<br/>[payment.py]"]
  node_payment_service["Services paiement<br/>[payment_service.py]"]
  node_passages["Tours de passage<br/>[passages.py]"]
  node_passage_model["Ordre et versements<br/>[passage.py]"]
end

subgraph group_messaging["Notifications"]
  node_notifications["Notifications API<br/>[notifications.py]"]
  node_notification_service["Envoi notifications"]
  node_notification_model["État notifications<br/>[notification.py]"]
end

subgraph group_persistence["Persistance"]
  node_db_session["Sessions SQLAlchemy<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

node_member(("Utilisateur"))

node_member -->|"appelle API"| node_api_entry
node_api_entry -->|"inclut routes"| node_router
node_router -->|"enregistre routes"| node_auth
node_router -->|"enregistre routes"| node_users
node_router -->|"enregistre routes"| node_tontines
node_router -->|"enregistre routes"| node_session_api
node_router -->|"enregistre routes"| node_payments
node_router -->|"enregistre routes"| node_passages
node_router -->|"enregistre routes"| node_notifications
node_auth -->|"lit et crée"| node_user_model
node_users -->|"gère comptes"| node_user_model
node_tontines -->|"gère groupes"| node_tontine_model
node_session_api -->|"gère cycles"| node_session_model
node_payments -->|"gère paiements"| node_payment_model
node_passages -->|"gère passages"| node_passage_model
node_notifications -->|"gère notifications"| node_notification_model
node_user_model -->|"déclare modèle"| node_db_session
node_tontine_model -->|"déclare modèle"| node_db_session
node_session_model -->|"déclare modèle"| node_db_session
node_payment_model -->|"déclare modèle"| node_db_session
node_passage_model -->|"déclare modèle"| node_db_session
node_notification_model -->|"déclare modèle"| node_db_session
node_db_session -->|"stocke données"| node_postgres
node_payments -.->|"intégration possible"| node_payment_service
node_notifications -.->|"envoi possible"| node_notification_service

click node_api_entry "https://github.com/naimlawani01/kobiri/blob/main/app/main.py"
click node_router "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/router.py"
click node_auth "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/auth.py"
click node_users "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/users.py"
click node_user_model "https://github.com/naimlawani01/kobiri/blob/main/app/models/user.py"
click node_tontines "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/tontines.py"
click node_tontine_model "https://github.com/naimlawani01/kobiri/blob/main/app/models/tontine.py"
click node_session_api "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/sessions.py"
click node_session_model "https://github.com/naimlawani01/kobiri/blob/main/app/models/session.py"
click node_payments "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/payments.py"
click node_payment_model "https://github.com/naimlawani01/kobiri/blob/main/app/models/payment.py"
click node_payment_service "https://github.com/naimlawani01/kobiri/blob/main/app/services/payment_service.py"
click node_passages "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/passages.py"
click node_passage_model "https://github.com/naimlawani01/kobiri/blob/main/app/models/passage.py"
click node_notifications "https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/notifications.py"
click node_notification_service "https://github.com/naimlawani01/kobiri/blob/main/app/services/notification_service.py"
click node_notification_model "https://github.com/naimlawani01/kobiri/blob/main/app/models/notification.py"
click node_db_session "https://github.com/naimlawani01/kobiri/blob/main/app/database.py"

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_entry,node_router,node_auth toneBlue
class node_users,node_user_model,node_tontines,node_tontine_model toneAmber
class node_session_api,node_session_model,node_payments,node_payment_model,node_payment_service,node_passages,node_passage_model toneMint
class node_notifications,node_notification_service,node_notification_model toneRose
class node_db_session,node_postgres,node_member toneIndigo
```

## Components

### API et accès

- [Application API](https://github.com/naimlawani01/kobiri/blob/main/app/main.py): `app/main.py`
- [Routeur v1](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/router.py): `app/api/v1/router.py`
- [Authentification](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/auth.py): `app/api/v1/endpoints/auth.py`

### Comptes et tontines

- [Gestion utilisateurs](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/users.py): `app/api/v1/endpoints/users.py`
- [Comptes et rôles](https://github.com/naimlawani01/kobiri/blob/main/app/models/user.py): `app/models/user.py`
- [Gestion tontines](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/tontines.py): `app/api/v1/endpoints/tontines.py`
- [Groupes et règles](https://github.com/naimlawani01/kobiri/blob/main/app/models/tontine.py): `app/models/tontine.py`

### Cotisations et tours

- [Sessions cotisation](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/sessions.py): `app/api/v1/endpoints/sessions.py`
- [Cycles de collecte](https://github.com/naimlawani01/kobiri/blob/main/app/models/session.py): `app/models/session.py`
- [Paiements](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/payments.py): `app/api/v1/endpoints/payments.py`
- [Enregistrements paiement](https://github.com/naimlawani01/kobiri/blob/main/app/models/payment.py): `app/models/payment.py`
- [Services paiement](https://github.com/naimlawani01/kobiri/blob/main/app/services/payment_service.py): `app/services/payment_service.py`
- [Tours de passage](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/passages.py): `app/api/v1/endpoints/passages.py`
- [Ordre et versements](https://github.com/naimlawani01/kobiri/blob/main/app/models/passage.py): `app/models/passage.py`

### Notifications

- [Notifications API](https://github.com/naimlawani01/kobiri/blob/main/app/api/v1/endpoints/notifications.py): `app/api/v1/endpoints/notifications.py`
- [Envoi notifications](https://github.com/naimlawani01/kobiri/blob/main/app/services/notification_service.py): `app/services/notification_service.py`
- [État notifications](https://github.com/naimlawani01/kobiri/blob/main/app/models/notification.py): `app/models/notification.py`

### Persistance

- [Sessions SQLAlchemy](https://github.com/naimlawani01/kobiri/blob/main/app/database.py): `app/database.py`
- **PostgreSQL**

### Other components

- **Utilisateur**

## Connections

- Utilisateur → Application API: appelle API (evidence: `README.md`)
- Application API → Routeur v1: inclut routes (evidence: `app/main.py`)
- Routeur v1 → Authentification: enregistre routes (evidence: `app/api/v1/router.py`)
- Routeur v1 → Gestion utilisateurs: enregistre routes (evidence: `app/api/v1/router.py`)
- Routeur v1 → Gestion tontines: enregistre routes (evidence: `app/api/v1/router.py`)
- Routeur v1 → Sessions cotisation: enregistre routes (evidence: `app/api/v1/router.py`)
- Routeur v1 → Paiements: enregistre routes (evidence: `app/api/v1/router.py`)
- Routeur v1 → Tours de passage: enregistre routes (evidence: `app/api/v1/router.py`)
- Routeur v1 → Notifications API: enregistre routes (evidence: `app/api/v1/router.py`)
- Authentification → Comptes et rôles: lit et crée (evidence: `app/api/v1/endpoints/auth.py`)
- Gestion utilisateurs → Comptes et rôles: gère comptes (evidence: `app/api/v1/endpoints/users.py`)
- Gestion tontines → Groupes et règles: gère groupes (evidence: `app/api/v1/endpoints/tontines.py`)
- Sessions cotisation → Cycles de collecte: gère cycles (evidence: `app/api/v1/endpoints/sessions.py`)
- Paiements → Enregistrements paiement: gère paiements (evidence: `app/api/v1/endpoints/payments.py`)
- Tours de passage → Ordre et versements: gère passages (evidence: `app/api/v1/endpoints/passages.py`)
- Notifications API → État notifications: gère notifications (evidence: `app/api/v1/endpoints/notifications.py`)
- Comptes et rôles → Sessions SQLAlchemy: déclare modèle (evidence: `app/models/user.py`)
- Groupes et règles → Sessions SQLAlchemy: déclare modèle (evidence: `app/models/tontine.py`)
- Cycles de collecte → Sessions SQLAlchemy: déclare modèle (evidence: `app/models/session.py`)
- Enregistrements paiement → Sessions SQLAlchemy: déclare modèle (evidence: `app/models/payment.py`)
- Ordre et versements → Sessions SQLAlchemy: déclare modèle (evidence: `app/models/passage.py`)
- État notifications → Sessions SQLAlchemy: déclare modèle (evidence: `app/models/notification.py`)
- Sessions SQLAlchemy → PostgreSQL: stocke données (evidence: `app/database.py`)
- Paiements → Services paiement: intégration possible
- Notifications API → Envoi notifications: envoi possible
