# vominhhung-sr/clinic-oupharmacy architecture

> Architecture diagram of the GitHub repository vominhhung-sr/clinic-oupharmacy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vominhhung-sr/clinic-oupharmacy
- Repository: https://github.com/vominhhung-sr/clinic-oupharmacy

## Overview

##### Main Components

a. Frontend Application:
- Located in the “oupharmacyapp” directory.
- Comprises modern JavaScript files (e.g., App.jsx, a “src” folder with pages, components, assets, and hooks) indicating a rich client-side UI.
- Includes internationalization support (locales folder), UI components (cards, charts, modals) and configuration files (vite.config.js, tailwind.config.cjs) for styling and bundling.

b. Backend Application:
- Found under “OUPharmacyManagementApp.”
- Built with Django (files such as settings.py, urls.py, wsgi.py/asgi.py show the standard Django project structure).
- Contains a “mainApp” which is the core application holding models, views, serializers, viewsets, and administrative utilities.
- Has asynchronous task management (celery.py and tasks.py files) to process background jobs.
- Includes integration for Firebase (firebase_config.py and firebase-related directories) for push notifications or other cloud communication.

c. External & Supporting Services:
- Database: Implicitly managed by Django using ORM (details in migrations and models).
- Firebase: Integrated on both backend (via firebase_config.py and signals) and frontend (firebase configuration and services) to manage real-time communication or authentication.
- Docker: Dockerfile(s) in both backend and frontend directories (and a top-level docker-compose.yml) indicate the containers for easy deployment.
- Deployment/CI: Files like railway.json and Docker configurations show that deployment is potentially managed via container orchestration.

##### Relationships & Interactions

- The Frontend (React app) communicates with the Backend through RESTful APIs defined in Django viewsets and serializers.
- The backend handles business logic, database operations, and triggers asynchronous tasks via Celery.
- Firebase acts as a bridge for real-time messaging/notifications – potentially used in both the frontend and backend.
- Docker configuration suggests that each major component (frontend, backend, and possibly the database) runs in isolated containers communicating through defined network interfaces.
- Internationalization and static asset delivery are handled on the frontend while Django serves the API and backend admin dashboard.

##### Architectural Patterns & Technologies

- MVC/MVT Pattern: The Django backend follows the Model-View-Template (MVT) architecture.
- Microservices-ish separation: Although part of one project, the clear separation into the “oupharmacyapp” for client and “OUPharmacyManagementApp” for server indicates a decoupled, service-oriented design.
- Asynchronous Task Processing: Celery integration for tasks such as email reminders or scheduled jobs.
- Containerization: Docker usage for isolated environments and easier deployment.
- Integration with external services: Firebase for push notifications, authentication, or real-time database updates.
- Use of state management and Redux in the frontend suggests a modern client-side architecture.

## Diagram (Mermaid)

```mermaid
graph TD
    A["Frontend (React Application)"]:::frontend
    B["Backend (Django Application)"]:::backend
    C["Core Business Logic & Models"]:::backend
    D["Asynchronous Task Manager (Celery)"]:::backend
    F1["Firebase (Backend)"]:::external
    F2["Firebase (Frontend)"]:::external
    G["Database (Django ORM)"]:::infrastructure
    H["Containerization (Docker)"]:::infrastructure

    %% Connections between nodes
    A -->|"REST_API_Call"| B
    B -->|"Contains"| C
    B -->|"Triggers"| D
    B -->|"SendsNotification"| F1
    A -->|"UsesFirebase"| F2
    B -->|"Reads/Writes"| G
    H -->|"Hosts"| A
    H -->|"Hosts"| B

    %% Click events based on component mapping
    click A "https://github.com/vominhhung-sr/clinic-oupharmacy/tree/main/oupharmacyapp"
    click B "https://github.com/vominhhung-sr/clinic-oupharmacy/tree/main/OUPharmacyManagementApp/OUPharmacyManagementApp"
    click C "https://github.com/vominhhung-sr/clinic-oupharmacy/tree/main/OUPharmacyManagementApp/mainApp"
    click D "https://github.com/vominhhung-sr/clinic-oupharmacy/blob/main/OUPharmacyManagementApp/OUPharmacyManagementApp/celery.py"
    click F1 "https://github.com/vominhhung-sr/clinic-oupharmacy/blob/main/OUPharmacyManagementApp/OUPharmacyManagementApp/firebase_config.py"
    click F2 "https://github.com/vominhhung-sr/clinic-oupharmacy/blob/main/oupharmacyapp/src/config/firebase.js"
    click G "https://github.com/vominhhung-sr/clinic-oupharmacy/tree/main/OUPharmacyManagementApp/mainApp/migrations"
    click H "https://github.com/vominhhung-sr/clinic-oupharmacy/blob/main/docker-compose.yml"

    %% Styles
    classDef frontend fill:#a3d9a5,stroke:#333,stroke-width:2px;
    classDef backend fill:#a5c8e0,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD580,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
