# anmolverma404/healthy-heartechs architecture

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

- Interactive diagram: https://gitdiagram.com/anmolverma404/healthy-heartechs
- Repository: https://github.com/anmolverma404/healthy-heartechs

## Overview

##### Main Components
- Client/Frontend – Located in the “client” directory. It contains HTML, CSS, and JavaScript files along with assets (images, SVGs) and views (HTML templates for various pages like signin, signup, appointment, etc.). This is where users interact with the interface.
- Server/Backend – Found in the “server” directory. It includes the main server file (app.js), various controllers (auth.js, medical.js, records.js), models (representing collections/tables like user, appointment, diseases, etc.), middleware for authentication, and routes for handling API endpoints.
- External Services – The project uses a Google Maps API for locating nearby doctors, as noted in the README. Also, Firebase appears to be configured for hosting (see the .firebase folder and firebase.json).

##### Relationships and Interactions
- The Client interacts with the Server via API calls (for authentication, fetching medical data, booking appointments, etc.), as indicated by the presence of separate routes and controllers.
- The Server likely communicates with a MongoDB database (as per the README). Models for storing users, appointments, medicines (allopathic and ayurvedic), and other health-related data encapsulate the database interactions.
- The Google Maps API serves as an external service that the frontend (or possibly the backend) calls to retrieve location-based data.

##### Architectural Patterns & Design Principles
- Separation of Concerns – The project separates client-side views and logic from the backend API, clearly dividing responsibilities.
- MVC-like Pattern on the server side – Although not explicitly named, having controllers, routes, models, and middleware indicates an organized layering similar to the MVC (Model-View-Controller) pattern.
- Use of External Hosted Services – Firebase for hosting and Google Maps API for location features are external dependencies that integrate into the design.

##### Key Technologies
- Frontend: HTML, CSS, JavaScript, possibly the use of SCSS for styling (client style.scss, appointment.scss, etc.).
- Backend: Node.js along with Express-style routing (indicated by server/app.js and modular routes controllers).
- Database: MongoDB (as described in the README).
- APIs: Google Maps API for geolocation services, and potential Firebase integration for hosting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (Client)"
        F0["Client: Frontend"]:::frontend
        F1["Views (HTML Templates)"]:::frontend
        F2["Static Assets (CSS, JS, Images)"]:::frontend
        F3["Utilities (Helpers)"]:::frontend
    end

    subgraph "Backend (Server)"
        B0["Server: Backend"]:::backend
        B1["API Endpoints"]:::backend
        B2["Controllers"]:::backend
        B3["Data Models"]:::backend
        B4["Middleware"]:::backend
    end

    subgraph "External Services"
        E1["Google Maps API"]:::external
        E2["Firebase Hosting"]:::external
    end

    D["(MongoDB)"]:::database

    %% Connections
    F0 -->|"API_Calls"| B1
    B1 -->|"auth_check"| B4
    B4 -->|"validated"| B2
    B2 -->|"CRUD_ops"| B3
    B3 -->|"data_flow"| D

    F0 -->|"geolocation"| E1
    E2 -->|"hosts"| F0

    %% Click Events
    click F0 "https://github.com/anmolverma404/healthy-heartechs/tree/main/client/"
    click B0 "https://github.com/anmolverma404/healthy-heartechs/tree/main/server/"
    click B1 "https://github.com/anmolverma404/healthy-heartechs/tree/main/server/routes/"
    click B2 "https://github.com/anmolverma404/healthy-heartechs/tree/main/server/controllers/"
    click B3 "https://github.com/anmolverma404/healthy-heartechs/tree/main/server/models/"
    click B4 "https://github.com/anmolverma404/healthy-heartechs/tree/main/server/middleware/"
    click E2 "https://github.com/anmolverma404/healthy-heartechs/tree/main/.firebase/"

    %% Styles
    classDef frontend fill:#CDEDF6,stroke:#000,stroke-width:1px;
    classDef backend fill:#F6ECD0,stroke:#000,stroke-width:1px;
    classDef database fill:#E0F6C9,stroke:#000,stroke-width:1px,stroke-dasharray:5,5;
    classDef external fill:#F6CDE0,stroke:#000,stroke-width:1px,stroke-dasharray:2,2;
```
