# akash-arjun-reddy/oliva-mad architecture

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

- Interactive diagram: https://gitdiagram.com/akash-arjun-reddy/oliva-mad
- Repository: https://github.com/akash-arjun-reddy/oliva-mad

## Overview

Oliva Clinic is a Flutter mobile app backed by a FastAPI clinic, commerce, and loyalty backend. The main user journey is authentication followed by browsing services and booking or managing appointments; separate backend routes support consultations, shopping, payments, and rewards. The repository also contains a second, separately structured meeting/doctor backend under `vedio/backend`. The Flutter Dart source is absent from the supplied tree, and several backend modules were not sampled, so some documented feature branches have no asserted internal call flow.

Main entry points: [`BackendMobileAPP/main.py`](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/main.py) (Clinic API), [`BackendMobileAPP/service/auth_service.py`](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/auth_service.py) (Authentication logic), [`BackendMobileAPP/controller/appointment_controller.py`](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/appointment_controller.py) (Appointment routes), [`BackendMobileAPP/shopify_controller.py`](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/shopify_controller.py) (Shop and orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api["Clinic API<br/>[main.py]"]
  node_settings["Configuration<br/>[settings.py]"]
  node_database[("Database sessions<br/>[connection.py]")]
end

subgraph group_identity["Identity and users"]
  node_auth_routes["Authentication routes<br/>[auth_controller.py]"]
  node_auth_service["Authentication logic<br/>[auth_service.py]"]
  node_jwt["JWT security<br/>[jwt.py]"]
  node_user_model[("User records<br/>[user.py]")]
end

subgraph group_clinic["Clinic workflows"]
  node_appointment_routes["Appointment routes"]
  node_appointment_service["Appointment logic"]
  node_appointment_store[("Appointment persistence")]
  node_services_routes["Clinic services"]
  node_consultation_routes["Consultation routes"]
  node_consultation_logic["Consultation logic"]
  node_email["Email and calendar<br/>[email_utils.py]"]
end

subgraph group_commerce["Commerce and loyalty"]
  node_shop_routes["Shop and orders"]
  node_shopify["Shopify integration<br/>[shopify_service.py]"]
  node_order_store[("Order records<br/>[order_models.py]")]
  node_rewards_routes["Rewards routes"]
  node_rewards_logic["Rewards engine"]
  node_rewards_store[("Rewards persistence")]
end

subgraph group_meetings["Meeting backend"]
  node_video_api["Video backend API<br/>[main.py]"]
  node_meeting_routes["Meeting routes"]
  node_meeting_logic["Meeting service<br/>[meeting_service.py]"]
  node_meeting_store[("Meeting persistence")]
  node_doctor_routes["Doctor routes"]
  node_email_service["Meeting email<br/>[email_service.py]"]
end

node_client(("Mobile user"))
node_email_provider["Email provider"]

node_client -->|"uses API"| node_api
node_api -->|"registers routes"| node_auth_routes
node_api -->|"registers routes"| node_appointment_routes
node_api -->|"registers routes"| node_services_routes
node_api -->|"registers routes"| node_consultation_routes
node_api -->|"registers routes"| node_shop_routes
node_api -->|"registers routes"| node_rewards_routes
node_api -->|"creates tables"| node_database
node_auth_routes -->|"calls"| node_auth_service
node_auth_service -->|"queries users"| node_user_model
node_auth_service -->|"reads settings"| node_settings
node_auth_service -.->|"uses tokens"| node_jwt
node_auth_service -.->|"validates Google token"| node_client
node_appointment_routes -->|"books appointments"| node_appointment_service
node_appointment_routes -->|"sends OTP"| node_auth_service
node_appointment_service -.->|"persists bookings"| node_appointment_store
node_appointment_routes -->|"opens sessions"| node_database
node_consultation_routes -->|"delegates"| node_consultation_logic
node_consultation_logic -.->|"sends email"| node_email
node_email -.->|"sends messages"| node_email_provider
node_shop_routes -->|"creates Shopify orders"| node_shopify
node_shop_routes -->|"writes orders"| node_order_store
node_rewards_routes -->|"calls engine"| node_rewards_logic
node_rewards_logic -->|"reads and updates"| node_rewards_store
node_video_api -.->|"registers routes"| node_meeting_routes
node_video_api -->|"registers routes"| node_doctor_routes
node_meeting_routes -->|"calls service"| node_meeting_logic
node_meeting_logic -.->|"uses repository"| node_meeting_store
node_meeting_routes -.->|"sends email"| node_email_service
node_email_service -.->|"delivers email"| node_email_provider

click node_api "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/main.py"
click node_settings "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/config/settings.py"
click node_database "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/database/connection.py"
click node_auth_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/auth_controller.py"
click node_auth_service "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/auth_service.py"
click node_jwt "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/security/jwt.py"
click node_user_model "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/models/user.py"
click node_appointment_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/appointment_controller.py"
click node_appointment_service "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/appointment_service.py"
click node_appointment_store "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/repository/appointment_repo.py"
click node_services_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/service_controller.py"
click node_consultation_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/consultation_controller.py"
click node_consultation_logic "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/consultation_service.py"
click node_email "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/utils/email_utils.py"
click node_shop_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/shopify_controller.py"
click node_shopify "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/shopify_service.py"
click node_order_store "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/models/order_models.py"
click node_rewards_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/rewards_controller.py"
click node_rewards_logic "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/rewards_engine_service.py"
click node_rewards_store "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/repository/rewards_repository.py"
click node_video_api "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/main.py"
click node_meeting_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/controllers/meeting_controller.py"
click node_meeting_logic "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/services/meeting_service.py"
click node_meeting_store "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/repositories/meeting_repository.py"
click node_doctor_routes "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/controllers/doctor_controller.py"
click node_email_service "https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/services/email_service.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,node_settings,node_database,node_client toneBlue
class node_auth_routes,node_auth_service,node_jwt,node_user_model toneAmber
class node_appointment_routes,node_appointment_service,node_appointment_store,node_services_routes,node_consultation_routes,node_consultation_logic,node_email toneMint
class node_shop_routes,node_shopify,node_order_store,node_rewards_routes,node_rewards_logic,node_rewards_store toneRose
class node_video_api,node_meeting_routes,node_meeting_logic,node_meeting_store,node_doctor_routes,node_email_service,node_email_provider toneIndigo
```

## Components

### API entry

- [Clinic API](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/main.py): `BackendMobileAPP/main.py`
- [Configuration](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/config/settings.py): `BackendMobileAPP/config/settings.py`
- [Database sessions](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/database/connection.py): `BackendMobileAPP/database/connection.py`

### Identity and users

- [Authentication routes](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/auth_controller.py): `BackendMobileAPP/controller/auth_controller.py`
- [Authentication logic](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/auth_service.py): `BackendMobileAPP/service/auth_service.py`
- [JWT security](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/security/jwt.py): `BackendMobileAPP/security/jwt.py`
- [User records](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/models/user.py): `BackendMobileAPP/models/user.py`

### Clinic workflows

- [Appointment routes](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/appointment_controller.py): `BackendMobileAPP/controller/appointment_controller.py`
- [Appointment logic](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/appointment_service.py): `BackendMobileAPP/service/appointment_service.py`
- [Appointment persistence](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/repository/appointment_repo.py): `BackendMobileAPP/repository/appointment_repo.py`
- [Clinic services](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/service_controller.py): `BackendMobileAPP/controller/service_controller.py`
- [Consultation routes](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/consultation_controller.py): `BackendMobileAPP/controller/consultation_controller.py`
- [Consultation logic](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/consultation_service.py): `BackendMobileAPP/service/consultation_service.py`
- [Email and calendar](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/utils/email_utils.py): `BackendMobileAPP/utils/email_utils.py`

### Commerce and loyalty

- [Shop and orders](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/shopify_controller.py): `BackendMobileAPP/shopify_controller.py`
- [Shopify integration](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/shopify_service.py): `BackendMobileAPP/shopify_service.py`
- [Order records](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/models/order_models.py): `BackendMobileAPP/models/order_models.py`
- [Rewards routes](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/controller/rewards_controller.py): `BackendMobileAPP/controller/rewards_controller.py`
- [Rewards engine](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/service/rewards_engine_service.py): `BackendMobileAPP/service/rewards_engine_service.py`
- [Rewards persistence](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/BackendMobileAPP/repository/rewards_repository.py): `BackendMobileAPP/repository/rewards_repository.py`

### Meeting backend

- [Video backend API](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/main.py): `vedio/backend/main.py`
- [Meeting routes](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/controllers/meeting_controller.py): `vedio/backend/app/controllers/meeting_controller.py`
- [Meeting service](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/services/meeting_service.py): `vedio/backend/app/services/meeting_service.py`
- [Meeting persistence](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/repositories/meeting_repository.py): `vedio/backend/app/repositories/meeting_repository.py`
- [Doctor routes](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/controllers/doctor_controller.py): `vedio/backend/app/controllers/doctor_controller.py`
- [Meeting email](https://github.com/akash-arjun-reddy/oliva-mad/blob/main/vedio/backend/app/services/email_service.py): `vedio/backend/app/services/email_service.py`

### Other components

- **Mobile user**
- **Email provider**

## Connections

- Mobile user → Clinic API: uses API (evidence: `README.md`)
- Clinic API → Authentication routes: registers routes (evidence: `BackendMobileAPP/main.py`)
- Clinic API → Appointment routes: registers routes (evidence: `BackendMobileAPP/main.py`)
- Clinic API → Clinic services: registers routes (evidence: `BackendMobileAPP/main.py`)
- Clinic API → Consultation routes: registers routes (evidence: `BackendMobileAPP/main.py`)
- Clinic API → Shop and orders: registers routes (evidence: `BackendMobileAPP/main.py`)
- Clinic API → Rewards routes: registers routes (evidence: `BackendMobileAPP/main.py`)
- Clinic API → Database sessions: creates tables (evidence: `BackendMobileAPP/main.py`)
- Authentication routes → Authentication logic: calls (evidence: `BackendMobileAPP/controller/auth_controller.py`)
- Authentication logic → User records: queries users (evidence: `BackendMobileAPP/service/auth_service.py`)
- Authentication logic → Configuration: reads settings (evidence: `BackendMobileAPP/service/auth_service.py`)
- Authentication logic → JWT security: uses tokens
- Authentication logic → Mobile user: validates Google token
- Appointment routes → Appointment logic: books appointments (evidence: `BackendMobileAPP/controller/appointment_controller.py`)
- Appointment routes → Authentication logic: sends OTP (evidence: `BackendMobileAPP/controller/appointment_controller.py`)
- Appointment logic → Appointment persistence: persists bookings
- Appointment routes → Database sessions: opens sessions (evidence: `BackendMobileAPP/controller/appointment_controller.py`)
- Consultation routes → Consultation logic: delegates (evidence: `BackendMobileAPP/controller/consultation_controller.py`)
- Consultation logic → Email and calendar: sends email
- Email and calendar → Email provider: sends messages
- Shop and orders → Shopify integration: creates Shopify orders (evidence: `BackendMobileAPP/shopify_controller.py`)
- Shop and orders → Order records: writes orders (evidence: `BackendMobileAPP/shopify_controller.py`)
- Rewards routes → Rewards engine: calls engine (evidence: `BackendMobileAPP/controller/rewards_controller.py`)
- Rewards engine → Rewards persistence: reads and updates (evidence: `BackendMobileAPP/service/rewards_engine_service.py`)
- Video backend API → Meeting routes: registers routes (evidence: `vedio/backend/main.py`)
- Video backend API → Doctor routes: registers routes (evidence: `vedio/backend/main.py`)
- Meeting routes → Meeting service: calls service (evidence: `vedio/backend/app/controllers/meeting_controller.py`)
- Meeting service → Meeting persistence: uses repository
- Meeting routes → Meeting email: sends email
- Meeting email → Email provider: delivers email
