# 2minstudio/fuel-backend architecture

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

- Interactive diagram: https://gitdiagram.com/2minstudio/fuel-backend
- Repository: https://github.com/2minstudio/fuel-backend

## Overview

This is a Django clinic-management application centered on patient and staff accounts, clinic schedules, appointment booking, invoicing and payment collection, with reporting and appointment communications as supporting capabilities. The principal workflow is an API request handled by the application views, which validate or serialize domain data and persist it through Django models; payment and reporting have their own view-to-domain layers. The README documents PostgreSQL and Celery operation, but sampled evidence does not establish all URL routing or asynchronous dispatch, so uncertain links are omitted or marked unverified.

Main entry points: [`appointment/views.py`](https://github.com/2minstudio/fuel-backend/blob/main/appointment/views.py) (Appointment API), [`appointment/serializers.py`](https://github.com/2minstudio/fuel-backend/blob/main/appointment/serializers.py) (Appointment serializers), [`appointment/models.py`](https://github.com/2minstudio/fuel-backend/blob/main/appointment/models.py) (Appointment catalog), [`payment/views.py`](https://github.com/2minstudio/fuel-backend/blob/main/payment/views.py) (Payment API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["People and clinics"]
  node_user_api["Account API<br/>[views.py]"]
  node_user_serializers["Account serializers<br/>[serializers.py]"]
  node_user_store[("User records<br/>[models.py]")]
  node_clinic_api["Clinic API<br/>[views.py]"]
  node_clinic_serializers["Clinic serializers<br/>[serializers.py]"]
  node_clinic_store[("Clinic and hours<br/>[models.py]")]
end

subgraph group_scheduling["Appointments"]
  node_appointment_api["Appointment API<br/>[views.py]"]
  node_appointment_serializers["Appointment serializers<br/>[serializers.py]"]
  node_appointment_store[("Appointment catalog<br/>[models.py]")]
end

subgraph group_finance["Billing and payments"]
  node_payment_api["Payment API<br/>[views.py]"]
  node_payment_serializers["Payment serializers<br/>[serializers.py]"]
  node_payment_store[("Invoices and payments<br/>[models.py]")]
  node_payment_logic["Payment utilities<br/>[utils.py]"]
end

subgraph group_operations["Communications"]
  node_tasks["Scheduled tasks<br/>[tasks.py]"]
  node_message_logic["Appointment messaging<br/>[utils.py]"]
  node_email_helper["Email delivery<br/>[email.py]"]
  node_sms_helper["SMS delivery<br/>[sms.py]"]
  node_notification_api["Notification API<br/>[views.py]"]
  node_notification_store[("Notifications<br/>[models.py]")]
end

subgraph group_insights["Reporting"]
  node_report_api["Report API<br/>[views.py]"]
  node_report_logic["Report calculations<br/>[utils.py]"]
  node_pagination["Report pagination<br/>[pagination.py]"]
end

node_patient(("Patient or staff"))
node_email_service["Email service"]

node_patient -.->|"sends request"| node_user_api
node_patient -.->|"books appointment"| node_appointment_api
node_user_api -->|"uses"| node_user_serializers
node_user_serializers -->|"validates records"| node_user_store
node_clinic_api -.->|"uses"| node_clinic_serializers
node_clinic_serializers -->|"serializes"| node_clinic_store
node_appointment_api -->|"uses"| node_appointment_serializers
node_appointment_api -->|"reads and writes"| node_appointment_store
node_appointment_api -->|"uses"| node_user_serializers
node_appointment_api -->|"reads"| node_clinic_store
node_appointment_api -->|"calls"| node_payment_api
node_appointment_serializers -->|"serializes"| node_appointment_store
node_appointment_serializers -->|"uses"| node_user_serializers
node_appointment_serializers -->|"uses"| node_clinic_serializers
node_appointment_serializers -->|"uses"| node_payment_logic
node_payment_api -->|"uses"| node_payment_serializers
node_payment_api -->|"reads and writes"| node_payment_store
node_payment_api -->|"uses"| node_payment_logic
node_payment_api -->|"reads"| node_appointment_store
node_payment_serializers -->|"serializes"| node_payment_store
node_payment_serializers -->|"reads procedures"| node_appointment_store
node_payment_serializers -->|"uses"| node_clinic_serializers
node_report_api -->|"calculates reports"| node_report_logic
node_report_api -->|"queries"| node_appointment_store
node_report_api -->|"queries"| node_payment_store
node_report_logic -->|"uses"| node_pagination
node_tasks -->|"reads appointments"| node_appointment_store
node_tasks -->|"uses"| node_appointment_serializers
node_tasks -->|"calls"| node_message_logic
node_message_logic -->|"uses"| node_email_helper
node_message_logic -->|"uses"| node_sms_helper
node_email_helper -->|"sends email"| node_email_service
node_notification_api -->|"reads and writes"| node_notification_store

click node_user_api "https://github.com/2minstudio/fuel-backend/blob/main/user/views.py"
click node_user_serializers "https://github.com/2minstudio/fuel-backend/blob/main/user/serializers.py"
click node_user_store "https://github.com/2minstudio/fuel-backend/blob/main/user/models.py"
click node_clinic_api "https://github.com/2minstudio/fuel-backend/blob/main/clinic/views.py"
click node_clinic_serializers "https://github.com/2minstudio/fuel-backend/blob/main/clinic/serializers.py"
click node_clinic_store "https://github.com/2minstudio/fuel-backend/blob/main/clinic/models.py"
click node_appointment_api "https://github.com/2minstudio/fuel-backend/blob/main/appointment/views.py"
click node_appointment_serializers "https://github.com/2minstudio/fuel-backend/blob/main/appointment/serializers.py"
click node_appointment_store "https://github.com/2minstudio/fuel-backend/blob/main/appointment/models.py"
click node_payment_api "https://github.com/2minstudio/fuel-backend/blob/main/payment/views.py"
click node_payment_serializers "https://github.com/2minstudio/fuel-backend/blob/main/payment/serializers.py"
click node_payment_store "https://github.com/2minstudio/fuel-backend/blob/main/payment/models.py"
click node_payment_logic "https://github.com/2minstudio/fuel-backend/blob/main/payment/utils.py"
click node_report_api "https://github.com/2minstudio/fuel-backend/blob/main/report/views.py"
click node_report_logic "https://github.com/2minstudio/fuel-backend/blob/main/report/utils.py"
click node_tasks "https://github.com/2minstudio/fuel-backend/blob/main/base/tasks.py"
click node_message_logic "https://github.com/2minstudio/fuel-backend/blob/main/base/utils.py"
click node_email_helper "https://github.com/2minstudio/fuel-backend/blob/main/base/helpers/email.py"
click node_sms_helper "https://github.com/2minstudio/fuel-backend/blob/main/base/helpers/sms.py"
click node_notification_api "https://github.com/2minstudio/fuel-backend/blob/main/notification/views.py"
click node_notification_store "https://github.com/2minstudio/fuel-backend/blob/main/notification/models.py"
click node_pagination "https://github.com/2minstudio/fuel-backend/blob/main/fuelapp/pagination.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_user_api,node_user_serializers,node_user_store,node_clinic_api,node_clinic_serializers,node_clinic_store toneBlue
class node_appointment_api,node_appointment_serializers,node_appointment_store toneAmber
class node_payment_api,node_payment_serializers,node_payment_store,node_payment_logic toneMint
class node_tasks,node_message_logic,node_email_helper,node_sms_helper,node_notification_api,node_notification_store toneRose
class node_report_api,node_report_logic,node_pagination,node_patient,node_email_service toneIndigo
```

## Components

### People and clinics

- [Account API](https://github.com/2minstudio/fuel-backend/blob/main/user/views.py): `user/views.py`
- [Account serializers](https://github.com/2minstudio/fuel-backend/blob/main/user/serializers.py): `user/serializers.py`
- [User records](https://github.com/2minstudio/fuel-backend/blob/main/user/models.py): `user/models.py`
- [Clinic API](https://github.com/2minstudio/fuel-backend/blob/main/clinic/views.py): `clinic/views.py`
- [Clinic serializers](https://github.com/2minstudio/fuel-backend/blob/main/clinic/serializers.py): `clinic/serializers.py`
- [Clinic and hours](https://github.com/2minstudio/fuel-backend/blob/main/clinic/models.py): `clinic/models.py`

### Appointments

- [Appointment API](https://github.com/2minstudio/fuel-backend/blob/main/appointment/views.py): `appointment/views.py`
- [Appointment serializers](https://github.com/2minstudio/fuel-backend/blob/main/appointment/serializers.py): `appointment/serializers.py`
- [Appointment catalog](https://github.com/2minstudio/fuel-backend/blob/main/appointment/models.py): `appointment/models.py`

### Billing and payments

- [Payment API](https://github.com/2minstudio/fuel-backend/blob/main/payment/views.py): `payment/views.py`
- [Payment serializers](https://github.com/2minstudio/fuel-backend/blob/main/payment/serializers.py): `payment/serializers.py`
- [Invoices and payments](https://github.com/2minstudio/fuel-backend/blob/main/payment/models.py): `payment/models.py`
- [Payment utilities](https://github.com/2minstudio/fuel-backend/blob/main/payment/utils.py): `payment/utils.py`

### Communications

- [Scheduled tasks](https://github.com/2minstudio/fuel-backend/blob/main/base/tasks.py): `base/tasks.py`
- [Appointment messaging](https://github.com/2minstudio/fuel-backend/blob/main/base/utils.py): `base/utils.py`
- [Email delivery](https://github.com/2minstudio/fuel-backend/blob/main/base/helpers/email.py): `base/helpers/email.py`
- [SMS delivery](https://github.com/2minstudio/fuel-backend/blob/main/base/helpers/sms.py): `base/helpers/sms.py`
- [Notification API](https://github.com/2minstudio/fuel-backend/blob/main/notification/views.py): `notification/views.py`
- [Notifications](https://github.com/2minstudio/fuel-backend/blob/main/notification/models.py): `notification/models.py`

### Reporting

- [Report API](https://github.com/2minstudio/fuel-backend/blob/main/report/views.py): `report/views.py`
- [Report calculations](https://github.com/2minstudio/fuel-backend/blob/main/report/utils.py): `report/utils.py`
- [Report pagination](https://github.com/2minstudio/fuel-backend/blob/main/fuelapp/pagination.py): `fuelapp/pagination.py`

### Other components

- **Patient or staff**
- **Email service**

## Connections

- Patient or staff → Account API: sends request
- Patient or staff → Appointment API: books appointment
- Account API → Account serializers: uses (evidence: `user/views.py`)
- Account serializers → User records: validates records (evidence: `user/serializers.py`)
- Clinic API → Clinic serializers: uses
- Clinic serializers → Clinic and hours: serializes (evidence: `clinic/serializers.py`)
- Appointment API → Appointment serializers: uses (evidence: `appointment/views.py`)
- Appointment API → Appointment catalog: reads and writes (evidence: `appointment/views.py`)
- Appointment API → Account serializers: uses (evidence: `appointment/views.py`)
- Appointment API → Clinic and hours: reads (evidence: `appointment/views.py`)
- Appointment API → Payment API: calls (evidence: `appointment/views.py`)
- Appointment serializers → Appointment catalog: serializes (evidence: `appointment/serializers.py`)
- Appointment serializers → Account serializers: uses (evidence: `appointment/serializers.py`)
- Appointment serializers → Clinic serializers: uses (evidence: `appointment/serializers.py`)
- Appointment serializers → Payment utilities: uses (evidence: `appointment/serializers.py`)
- Payment API → Payment serializers: uses (evidence: `payment/views.py`)
- Payment API → Invoices and payments: reads and writes (evidence: `payment/views.py`)
- Payment API → Payment utilities: uses (evidence: `payment/views.py`)
- Payment API → Appointment catalog: reads (evidence: `payment/views.py`)
- Payment serializers → Invoices and payments: serializes (evidence: `payment/serializers.py`)
- Payment serializers → Appointment catalog: reads procedures (evidence: `payment/serializers.py`)
- Payment serializers → Clinic serializers: uses (evidence: `payment/serializers.py`)
- Report API → Report calculations: calculates reports (evidence: `report/views.py`)
- Report API → Appointment catalog: queries (evidence: `report/views.py`)
- Report API → Invoices and payments: queries (evidence: `report/views.py`)
- Report calculations → Report pagination: uses (evidence: `report/utils.py`)
- Scheduled tasks → Appointment catalog: reads appointments (evidence: `base/tasks.py`)
- Scheduled tasks → Appointment serializers: uses (evidence: `base/tasks.py`)
- Scheduled tasks → Appointment messaging: calls (evidence: `base/tasks.py`)
- Appointment messaging → Email delivery: uses (evidence: `base/utils.py`)
- Appointment messaging → SMS delivery: uses (evidence: `base/utils.py`)
- Email delivery → Email service: sends email (evidence: `base/helpers/email.py`)
- Notification API → Notifications: reads and writes (evidence: `notification/views.py`)
