# saianandmohan-cts/healthcarefe architecture

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

- Interactive diagram: https://gitdiagram.com/saianandmohan-cts/healthcarefe
- Repository: https://github.com/saianandmohan-cts/healthcarefe

## Overview

1. This is an Angular 21 single-page frontend for a healthcare domain. The repository contains no server-side code; the architecture is client application only, with business interactions likely going through HTTP services to a separate backend API.

2. The app is organized around role-based user journeys: patient and doctor. The main flows visible from the component set are registration/login, patient dashboard/profile/appointments, doctor dashboard/availability/prescriptions, and consultation history/prescription viewing.

3. Routing is centralized in `src/app/app.routes.ts`, with application bootstrap/config in `app.config.ts` and root shell files in `app.ts`, `app.html`, and `app.css`. That implies Angular’s standalone-style application structure rather than a classic NgModule-heavy layout.

4. UI is split into feature components under `src/app/components`, each representing a screen or screen-level widget:
   - authentication: `login-user`, `register-user`, `login-doctor`
   - patient features: `patient-dashboard`, `patient-profile`, `bookappointment`, `modifyappointment`, `patient-appointments`, `view-prescription`, `past-consultation`
   - doctor features: `doctor-dashboard`, `doctor-availability-slot`, `add-prescription`, `past-consultation-list`
   - home/landing: `home`

5. The app’s domain model layer is explicit under `src/app/models`. The main entities are `appointment`, `availability`, `consultation`, `doctor`, `patient`, and `user-role`. These models likely define the data shape exchanged between components and services and help separate UI logic from backend payloads.

6. The service layer under `src/app/services` is the main integration boundary. It includes:
   - `auth.ts` for login/session/token handling
   - `appointment.service.ts` for booking/modifying/fetching appointments
   - `doctor.service.ts` for doctor-related data and availability
   - `dashboard.service.ts` for dashboard summaries or aggregated data
   - `past-consultations.ts` for retrieving consultation history
   - `add-prescription.ts` for prescription creation
   These services are the likely point where the app calls the backend API.

7. Authentication is treated as a cross-cutting concern. `auth-interceptor.ts` suggests outgoing HTTP requests are enriched with auth headers, and `guards/auth-guard.ts` protects routes based on authentication state and/or role. Together they form the app’s access-control boundary.

8. The data flow is typical of a layered Angular SPA: user interacts with a feature component, the component calls a domain service, the service talks to the backend over HTTP, returned data is mapped into models, and the UI renders the result. Protected routes likely require the guard, while HTTP requests rely on the interceptor for token propagation.

9. The application appears to support two operational views of the same medical workflow:
   - patients can register, log in, book or edit appointments, view prescriptions, and see consultation history
   - doctors can log in, manage availability, review patient history, and add prescriptions
   This split is central to any architecture diagram.

10. `public/` contains static assets, while `src/styles.css` and per-component CSS files show that styling is primarily component-scoped with some global styling at the app level. There is no evidence of a separate design system or UI library in the file tree.

11. Testing is present but mostly scaffolded per component/service, with `.spec.ts` files colocated next to source files. The README says tests run with Vitest via `ng test`, so the repo is configured for Angular CLI + Vitest rather than Jasmine/Karma.

12. A small structural oddity is visible in `past-consultation-list` and `view-prescription`, where there is an extra nested folder level in the tree. That looks like a packaging or generation artifact, not a distinct architectural layer.

13. For an architecture diagram, the key boxes are: Angular shell/routing, auth boundary (guard + interceptor), patient/doctor feature screens, shared domain models, and backend service integration. The system boundary is the browser; everything beyond the services is external API/dependency.

Main entry points: [`src/app/components/patient-dashboard/patient-dashboard.ts`](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-dashboard/patient-dashboard.ts) (Patient dashboard), [`src/app/services/appointment.service.ts`](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/appointment.service.ts) (Appointment service), [`src/app/services/dashboard.service.ts`](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/dashboard.service.ts) (Dashboard service), [`src/app/models`](https://github.com/saianandmohan-cts/healthcarefe/tree/main/src/app/models) (Domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_shell["Angular shell"]
  node_app_ts["App root<br/>standalone shell<br/>[app.ts]"]
  node_app_routes["Routes<br/>route config<br/>[app.routes.ts]"]
  node_app_config["Config<br/>[app.config.ts]"]
  node_main_ts["Main entry<br/>bootstrap<br/>[main.ts]"]
end

subgraph group_group_access["Access control"]
  node_auth_guard{{"Auth guard<br/>route guard<br/>[auth-guard.ts]"}}
  node_auth_interceptor{{"HTTP interceptor<br/>request interceptor"}}
end

subgraph group_group_patient["Patient journeys"]
  node_login_user["Patient login<br/>auth screen<br/>[login-user.ts]"]
  node_register_user["Register<br/>auth screen<br/>[register-user.ts]"]
  node_patient_dashboard["Patient dashboard<br/>patient screen"]
  node_patient_profile["Profile<br/>patient screen<br/>[patient-profile.ts]"]
  node_book_appointment["Book visit<br/>patient screen<br/>[bookappointment.ts]"]
  node_modify_appointment["Edit visit<br/>patient screen"]
  node_patient_appointments["Appointments<br/>patient screen"]
  node_view_prescription["View Rx<br/>patient screen"]
  node_past_consultation["Consultation history<br/>patient screen"]
end

subgraph group_group_doctor["Doctor journeys"]
  node_login_doctor["Doctor login<br/>auth screen<br/>[login-doctor.ts]"]
  node_doctor_dashboard["Doctor dashboard<br/>doctor screen"]
  node_availability_slot["Availability<br/>doctor screen"]
  node_add_prescription["Add Rx<br/>doctor screen"]
  node_past_consultation_list["Consult list<br/>doctor screen"]
end

subgraph group_group_shared["Shared domain"]
  node_models[("Domain models<br/>entity models")]
end

subgraph group_group_services["API services"]
  node_auth_service["Auth service<br/>session service<br/>[auth.ts]"]
  node_appointment_service["Appointment service<br/>booking service"]
  node_doctor_service["Doctor service<br/>doctor api<br/>[doctor.service.ts]"]
  node_dashboard_service["Dashboard service<br/>summary api"]
  node_past_consultations_service["Consult history<br/>history api"]
  node_add_prescription_service["Prescription api<br/>prescription service"]
end

node_backend_api[("Backend API<br/>external http api")]

node_main_ts -->|"bootstraps"| node_app_config
node_app_config -->|"registers"| node_app_routes
node_app_ts -->|"navigates"| node_app_routes
node_app_routes -->|"protects"| node_auth_guard
node_app_config -->|"provides"| node_auth_interceptor
node_login_user -->|"authenticates"| node_auth_service
node_register_user -->|"registers"| node_auth_service
node_login_doctor -->|"authenticates"| node_auth_service
node_auth_service -->|"calls"| node_backend_api
node_auth_interceptor -->|"adds token"| node_backend_api
node_patient_dashboard -->|"loads"| node_dashboard_service
node_doctor_dashboard -->|"loads"| node_dashboard_service
node_patient_profile -->|"reads"| node_dashboard_service
node_book_appointment -->|"books"| node_appointment_service
node_modify_appointment -->|"updates"| node_appointment_service
node_patient_appointments -->|"lists"| node_appointment_service
node_doctor_service -->|"calls"| node_backend_api
node_appointment_service -->|"calls"| node_backend_api
node_dashboard_service -->|"calls"| node_backend_api
node_past_consultations_service -->|"calls"| node_backend_api
node_add_prescription_service -->|"calls"| node_backend_api
node_doctor_dashboard -->|"manages"| node_availability_slot
node_doctor_dashboard -->|"creates"| node_add_prescription
node_doctor_dashboard -->|"reviews"| node_past_consultation_list
node_patient_dashboard -->|"starts"| node_book_appointment
node_patient_dashboard -->|"shows"| node_patient_profile
node_patient_dashboard -->|"shows"| node_patient_appointments
node_patient_dashboard -->|"shows"| node_view_prescription
node_patient_dashboard -->|"shows"| node_past_consultation
node_past_consultation -->|"reads"| node_past_consultations_service
node_past_consultation_list -->|"reads"| node_past_consultations_service
node_view_prescription -->|"reads"| node_appointment_service
node_add_prescription -->|"writes"| node_add_prescription_service
node_appointment_service -->|"maps"| node_models
node_doctor_service -->|"maps"| node_models
node_dashboard_service -->|"maps"| node_models
node_past_consultations_service -->|"maps"| node_models
node_add_prescription_service -->|"maps"| node_models

click node_app_ts "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/app.ts"
click node_app_routes "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/app.routes.ts"
click node_app_config "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/app.config.ts"
click node_main_ts "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/main.ts"
click node_auth_guard "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/guards/auth-guard.ts"
click node_auth_interceptor "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/auth-interceptor.ts"
click node_login_user "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/login-user/login-user.ts"
click node_register_user "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/register-user/register-user.ts"
click node_patient_dashboard "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-dashboard/patient-dashboard.ts"
click node_patient_profile "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-profile/patient-profile.ts"
click node_book_appointment "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/bookappointment/bookappointment.ts"
click node_modify_appointment "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/modifyappointment/modifyappointment.ts"
click node_patient_appointments "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-appointments/patient-appointments.ts"
click node_view_prescription "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/view-prescription/view-prescription/view-prescription.ts"
click node_past_consultation "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/past-consultation/past-consultation.ts"
click node_login_doctor "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/login-doctor/login-doctor.ts"
click node_doctor_dashboard "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/doctor-dashboard/doctor-dashboard.ts"
click node_availability_slot "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/doctor-availability-slot/doctor-availability-slot.ts"
click node_add_prescription "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/add-prescription/add-prescription.ts"
click node_past_consultation_list "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/past-consultation-list/past-consultation-list/past-consultation-list.ts"
click node_models "https://github.com/saianandmohan-cts/healthcarefe/tree/main/src/app/models"
click node_auth_service "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/auth.ts"
click node_appointment_service "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/appointment.service.ts"
click node_doctor_service "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/doctor.service.ts"
click node_dashboard_service "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/dashboard.service.ts"
click node_past_consultations_service "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/past-consultations.ts"
click node_add_prescription_service "https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/add-prescription.ts"

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_app_ts,node_app_routes,node_app_config,node_main_ts toneBlue
class node_auth_guard,node_auth_interceptor toneAmber
class node_login_user,node_register_user,node_patient_dashboard,node_patient_profile,node_book_appointment,node_modify_appointment,node_patient_appointments,node_view_prescription,node_past_consultation toneMint
class node_login_doctor,node_doctor_dashboard,node_availability_slot,node_add_prescription,node_past_consultation_list toneRose
class node_models toneIndigo
class node_auth_service,node_appointment_service,node_doctor_service,node_dashboard_service,node_past_consultations_service,node_add_prescription_service toneTeal
class node_backend_api toneNeutral
```

## Components

### Angular shell

Standalone app bootstrap, routing, and root layout.

- [App root](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/app.ts): standalone shell · Root application component and shell entry point. · `src/app/app.ts`
- [Routes](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/app.routes.ts): route config · Centralized route definitions for the SPA. · `src/app/app.routes.ts`
- [Config](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/app.config.ts): bootstrap config · Application-wide providers and startup configuration. · `src/app/app.config.ts`
- [Main entry](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/main.ts): bootstrap · Browser bootstrap entry for the Angular app. · `src/main.ts`

### Access control

Authentication boundary for protected routes and HTTP requests.

- [Auth guard](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/guards/auth-guard.ts): route guard · Protects routes based on login and role state. · `src/app/guards/auth-guard.ts`
- [HTTP interceptor](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/auth-interceptor.ts): request interceptor · Adds auth headers to outgoing HTTP requests. · `src/app/auth-interceptor.ts`

### Patient journeys

Screens for patient onboarding and self-service care flows.

- [Patient login](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/login-user/login-user.ts): auth screen · Patient authentication screen. · `src/app/components/login-user/login-user.ts`
- [Register](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/register-user/register-user.ts): auth screen · Patient registration screen. · `src/app/components/register-user/register-user.ts`
- [Patient dashboard](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-dashboard/patient-dashboard.ts): patient screen · Patient landing area and summary view. · `src/app/components/patient-dashboard/patient-dashboard.ts`
- [Profile](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-profile/patient-profile.ts): patient screen · Patient profile and personal details view. · `src/app/components/patient-profile/patient-profile.ts`
- [Book visit](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/bookappointment/bookappointment.ts): patient screen · Creates new appointments for patients. · `src/app/components/bookappointment/bookappointment.ts`
- [Edit visit](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/modifyappointment/modifyappointment.ts): patient screen · Updates existing patient appointments. · `src/app/components/modifyappointment/modifyappointment.ts`
- [Appointments](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/patient-appointments/patient-appointments.ts): patient screen · Lists patient appointment history and upcoming visits. · `src/app/components/patient-appointments/patient-appointments.ts`
- [View Rx](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/view-prescription/view-prescription/view-prescription.ts): patient screen · Displays prescriptions for patients. · `src/app/components/view-prescription/view-prescription/view-prescription.ts`
- [Consultation history](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/past-consultation/past-consultation.ts): patient screen · Patient-facing consultation history screen. · `src/app/components/past-consultation/past-consultation.ts`

### Doctor journeys

Screens for clinician scheduling and treatment workflows.

- [Doctor login](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/login-doctor/login-doctor.ts): auth screen · Doctor authentication screen. · `src/app/components/login-doctor/login-doctor.ts`
- [Doctor dashboard](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/doctor-dashboard/doctor-dashboard.ts): doctor screen · Doctor landing area and summary view. · `src/app/components/doctor-dashboard/doctor-dashboard.ts`
- [Availability](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/doctor-availability-slot/doctor-availability-slot.ts): doctor screen · Manages doctor availability slots. · `src/app/components/doctor-availability-slot/doctor-availability-slot.ts`
- [Add Rx](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/add-prescription/add-prescription.ts): doctor screen · Creates prescriptions during consultations. · `src/app/components/add-prescription/add-prescription.ts`
- [Consult list](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/components/past-consultation-list/past-consultation-list/past-consultation-list.ts): doctor screen · Doctor-facing list of past consultations. · `src/app/components/past-consultation-list/past-consultation-list/past-consultation-list.ts`

### Shared domain

Common models used across screens and services.

- [Domain models](https://github.com/saianandmohan-cts/healthcarefe/tree/main/src/app/models): entity models · Shared data shapes for appointments, consultations, doctors, and patients. · `src/app/models`

### API services

Client-side integration layer to the backend API.

- [Auth service](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/auth.ts): session service · Handles login and session/token state. · `src/app/services/auth.ts`
- [Appointment service](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/appointment.service.ts): booking service · Books, updates, and fetches appointments. · `src/app/services/appointment.service.ts`
- [Doctor service](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/doctor.service.ts): doctor api · Fetches doctor data and availability. · `src/app/services/doctor.service.ts`
- [Dashboard service](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/dashboard.service.ts): summary api · Provides dashboard-level aggregated data. · `src/app/services/dashboard.service.ts`
- [Consult history](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/past-consultations.ts): history api · Retrieves consultation history for patient and doctor flows. · `src/app/services/past-consultations.ts`
- [Prescription api](https://github.com/saianandmohan-cts/healthcarefe/blob/main/src/app/services/add-prescription.ts): prescription service · Supports prescription creation and persistence. · `src/app/services/add-prescription.ts`

### Other components

- **Backend API**: external http api · External server API consumed by the Angular client.

## Connections

- Main entry → Config: bootstraps · Initializes the app with global providers.
- Config → Routes: registers · Wires route configuration into the application.
- App root → Routes: navigates · Root shell hosts the routed views.
- Routes → Auth guard: protects · Protected journeys require authentication and role checks.
- Config → HTTP interceptor: provides · Registers the HTTP interceptor globally.
- Patient login → Auth service: authenticates · Patient login uses the auth service.
- Register → Auth service: registers · Registration submits identity data through auth handling.
- Doctor login → Auth service: authenticates · Doctor login uses the auth service.
- Auth service → Backend API: calls · Sends auth requests to the API.
- HTTP interceptor → Backend API: adds token · Attaches credentials to outgoing API calls.
- Patient dashboard → Dashboard service: loads · Pulls patient summary data.
- Doctor dashboard → Dashboard service: loads · Pulls doctor summary data.
- Profile → Dashboard service: reads · Uses shared summary/profile data.
- Book visit → Appointment service: books · Creates appointments.
- Edit visit → Appointment service: updates · Edits existing appointments.
- Appointments → Appointment service: lists · Fetches patient appointment records.
- Doctor service → Backend API: calls · Fetches doctor and availability data.
- Appointment service → Backend API: calls · Reads and writes appointment data.
- Dashboard service → Backend API: calls · Fetches dashboard aggregates from the API.
- Consult history → Backend API: calls · Retrieves consultation history from the API.
- Prescription api → Backend API: calls · Submits prescription data to the API.
- Doctor dashboard → Availability: manages · Doctor workflow includes availability setup.
- Doctor dashboard → Add Rx: creates · Doctor workflow includes prescription creation.
- Doctor dashboard → Consult list: reviews · Doctor workflow includes consultation review.
- Patient dashboard → Book visit: starts · Patients navigate into booking from the dashboard.
- Patient dashboard → Profile: shows · Dashboard links to profile management.
- Patient dashboard → Appointments: shows · Dashboard links to appointment lists.
- Patient dashboard → View Rx: shows · Dashboard links to prescription viewing.
- Patient dashboard → Consultation history: shows · Dashboard links to consultation history.
- Consultation history → Consult history: reads · Patient history screen queries the consultation history service.
- Consult list → Consult history: reads · Doctor history screen queries the consultation history service.
- View Rx → Appointment service: reads · Prescription view may derive from appointment-linked records.
- Add Rx → Prescription api: writes · Prescription entry submits through the prescription service.
- Appointment service → Domain models: maps · Appointment payloads use shared domain models.
- Doctor service → Domain models: maps · Doctor-related payloads use shared domain models.
- Dashboard service → Domain models: maps · Summary data is shaped by shared models.
- Consult history → Domain models: maps · Consultation history uses shared models.
- Prescription api → Domain models: maps · Prescription-related payloads use shared domain models.
