# maxlapeuff/allomedecin architecture

> Architecture diagram of the GitHub repository maxlapeuff/allomedecin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maxlapeuff/allomedecin
- Repository: https://github.com/maxlapeuff/allomedecin

## Overview

##### Project Type and Purpose
- AlloMédecin is a monolithic full-stack web application (backend-driven) built with Django, exposing REST endpoints (via serializers/views) and using PostgreSQL for data persistence. It provides a platform to manage user accounts (patients/medecins), schedule and track consultations, handle notifications, and process payments.

##### File‐Structure Analysis
- Top‐Level Files:
- manage.py – Django CLI entry point
- requirements.txt – Python dependencies
- allomedecin/ – project settings, URL routing, WSGI/ASGI startup
- Django Apps:
- admin/ – custom admin extensions, models, views for back-office
- users/ – user model, serializers, views, URL endpoints
- consultations/ – consultation scheduling, status management, serializers, views
- notifications/ – creating/sending notifications (e-mail, SMS, in-app)
- payments/ – payment models and processing logic
- No dedicated “frontend” directory implies server-rendered UI (Django templates) or a separate frontend repo not shown here.

##### Key README Insights
- Tech stack: Django (Python 3.12+), PostgreSQL
- Runtime: manage.py runserver (dev), WSGI/ASGI on production
- Environment config: .env variables for DB and Django settings

a. Main Components
- Clients (Web browsers/mobile apps)
- Reverse Proxy / Load Balancer (e.g., Nginx)
- Django Application Server (Gunicorn / uWSGI)
- Django Apps Modules (admin, users, consultations, notifications, payments)
- PostgreSQL Database
- External Services: SMTP server (for e-mails), Payment Gateway (Stripe/PayPal API)
b. Relationships & Data Flows
- Client → Reverse Proxy: HTTP(s) requests
- Reverse Proxy → Django WSGI/ASGI: forwards requests
- Django Server routes to app URLs → appropriate view/serializer → ORM → DB
- Notifications app triggers external SMTP or SMS gateway
- Payments app communicates with third-party payment API and writes transaction logs to DB
c. Architectural Patterns
- Monolithic modular design: each Django “app” encapsulates a domain
- Layered architecture:
– Presentation (Django Templates or REST endpoints)
– Business Logic (views, serializers, services inside each app)
– Data Access (Django ORM)
- 12-factor app practices: environment configuration, separate settings, dependency management
d. Core Technologies
- Django (REST framework serializers + views)
- PostgreSQL (persistent storage)
- Gunicorn/uWSGI + Nginx
- dotenv for configuration
- Third-party services: SMTP, Payment Gateway APIs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients"
        direction TB
        WebBrowser["Web Browser"]:::client
        MobileApp["Mobile App"]:::client
    end

    %% Reverse Proxy Layer
    NginxProxy["Nginx (Reverse Proxy)"]:::proxy

    %% Server Layer
    subgraph "Django Monolith"
        direction TB
        ManagePy["manage.py"]:::config
        Requirements["requirements.txt"]:::config
        Env[".env (Configuration)"]:::config

        subgraph "Project Core"
            direction TB
            Settings["Settings Module\n(allomedecin/settings.py)"]:::config
            URLRouter["URL Router\n(allomedecin/urls.py)"]:::config
            WSGI["WSGI Entry Point\n(allomedecin/wsgi.py)"]:::config
            ASGI["ASGI Entry Point\n(allomedecin/asgi.py)"]:::config
        end

        subgraph "Django Apps"
            direction TB
            AdminApp["Admin App"]:::djangoApp
            UsersApp["Users App"]:::djangoApp
            ConsultationsApp["Consultations App"]:::djangoApp
            NotificationsApp["Notifications App"]:::djangoApp
            PaymentsApp["Payments App"]:::djangoApp
        end
    end

    %% Data & External Services Layer
    subgraph "Data & External Services"
        direction TB
        PostgresDB["PostgreSQL Database"]:::db
        SMTP["SMTP Server"]:::external
        PaymentGateway["Payment Gateway API"]:::external
    end

    %% Connections
    WebBrowser -->|"HTTP(S)"| NginxProxy
    MobileApp -->|"HTTP(S)"| NginxProxy

    NginxProxy -->|"forwards request"| WSGI
    NginxProxy -->|"forwards request"| ASGI

    WSGI -->|"loads"| URLRouter
    ASGI -->|"loads"| URLRouter

    URLRouter -->|"routes to views"| AdminApp
    URLRouter -->|"routes to views"| UsersApp
    URLRouter -->|"routes to views"| ConsultationsApp
    URLRouter -->|"routes to views"| NotificationsApp
    URLRouter -->|"routes to views"| PaymentsApp

    AdminApp -->|"ORM queries"| PostgresDB
    UsersApp -->|"ORM queries"| PostgresDB
    ConsultationsApp -->|"ORM queries"| PostgresDB
    NotificationsApp -->|"ORM queries"| PostgresDB
    PaymentsApp -->|"ORM queries"| PostgresDB

    NotificationsApp -.->|"sends email/SMS"| SMTP
    PaymentsApp -->|"calls API"| PaymentGateway
    PaymentGateway -->|"webhook/response"| PaymentsApp

    %% Configuration flow
    Env --> Settings
    Requirements --> ManagePy

    %% Click Events
    click ManagePy "https://github.com/maxlapeuff/allomedecin/blob/main/manage.py"
    click Requirements "https://github.com/maxlapeuff/allomedecin/blob/main/requirements.txt"
    click Settings "https://github.com/maxlapeuff/allomedecin/blob/main/allomedecin/settings.py"
    click URLRouter "https://github.com/maxlapeuff/allomedecin/blob/main/allomedecin/urls.py"
    click WSGI "https://github.com/maxlapeuff/allomedecin/blob/main/allomedecin/wsgi.py"
    click ASGI "https://github.com/maxlapeuff/allomedecin/blob/main/allomedecin/asgi.py"
    click AdminApp "https://github.com/maxlapeuff/allomedecin/tree/main/admin/"
    click UsersApp "https://github.com/maxlapeuff/allomedecin/tree/main/users/"
    click ConsultationsApp "https://github.com/maxlapeuff/allomedecin/tree/main/consultations/"
    click NotificationsApp "https://github.com/maxlapeuff/allomedecin/tree/main/notifications/"
    click PaymentsApp "https://github.com/maxlapeuff/allomedecin/tree/main/payments/"

    %% Styles
    classDef client fill:#D6E9F8,stroke:#31708F,color:#31708F;
    classDef proxy fill:#F2F2F2,stroke:#8C8C8C,color:#333;
    classDef config fill:#FCF8E3,stroke:#8A6D3B,color:#8A6D3B;
    classDef djangoApp fill:#DFF0D8,stroke:#3C763D,color:#3C763D;
    classDef db fill:#FCF8E3,stroke:#8A6D3B,color:#8A6D3B;
    classDef external fill:#F2DEDE,stroke:#A94442,color:#A94442;
```
