# sunnyshin8/magicmeds architecture

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

- Interactive diagram: https://gitdiagram.com/sunnyshin8/magicmeds
- Repository: https://github.com/sunnyshin8/magicmeds

## Overview

MagicMeds is a healthcare platform whose demonstrated runtime workflow is a user asking a health question in the Home chat: the chat UI posts to a server route, which validates and enriches the request with medicine data before calling Gemini and returning a response. The broader product also documents authentication, appointments, telehealth, analytics, services, education, and support; their pages are represented, but their internal behavior was not inspected. Predictive health intelligence and the fever helpline are described as coming soon. Edges reflect shown calls, links, or documented integrations only.

Main entry points: [`src/components/NavBar.tsx`](https://github.com/sunnyshin8/magicmeds/blob/main/src/components/NavBar.tsx) (Navigation), [`src/components/ChatInterface.tsx`](https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatInterface.tsx) (Chat interface), [`src/app/api/chat/route.ts`](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/api/chat/route.ts) (Chat API), [`src/app/home/page.tsx`](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/home/page.tsx) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Home page<br/>[page.tsx]"]
  node_navbar["Navigation<br/>[NavBar.tsx]"]
  node_about["About page<br/>[page.tsx]"]
  node_contact["Contact<br/>[page.tsx]"]
end

subgraph group_care["Care features"]
  node_login["Login<br/>[page.tsx]"]
  node_signup["Registration<br/>[page.tsx]"]
  node_appointments["Appointments<br/>[page.tsx]"]
  node_telehealth["Telehealth<br/>[page.tsx]"]
  node_dashboard["Health dashboard<br/>[page.tsx]"]
  node_services["Service directory<br/>[page.tsx]"]
  node_articles["Health articles<br/>[page.tsx]"]
  node_support["Support<br/>[page.tsx]"]
end

subgraph group_assistant["AI assistant"]
  node_chat["Chat interface<br/>[ChatInterface.tsx]"]
  node_chatinput["Chat input<br/>[ChatInput.tsx]"]
  node_chatmessage["Chat message<br/>[ChatMessage.tsx]"]
  node_chatapi["Chat API<br/>[route.ts]"]
  node_medicines[("Medicine database")]
  node_ai_service["Gemini service<br/>[googleAIStudio.ts]"]
end

subgraph group_presentation["Presentation layer"]
  node_theme_registry["Theme registry<br/>[ThemeRegistry.tsx]"]
  node_theme["MUI theme<br/>[theme.ts]"]
end

node_user(("Healthcare user"))
node_gemini{{"Google Gemini"}}

node_user -->|"opens"| node_home
node_home -->|"renders"| node_chat
node_chat -->|"renders"| node_chatinput
node_chat -->|"renders"| node_chatmessage
node_chat -->|"posts message"| node_chatapi
node_chatapi -->|"looks up symptoms"| node_medicines
node_chatapi -->|"requests response"| node_ai_service
node_ai_service -->|"generates content"| node_gemini
node_navbar -->|"links to"| node_about
node_navbar -->|"links to"| node_home
node_navbar -->|"links to"| node_services
node_navbar -->|"links to"| node_articles
node_navbar -->|"links to"| node_telehealth
node_navbar -->|"links to"| node_appointments
node_navbar -->|"links to"| node_dashboard
node_navbar -->|"links to"| node_contact
node_navbar -->|"links to"| node_support
node_navbar -->|"links to"| node_login
node_navbar -->|"links to"| node_signup
node_theme_registry -->|"uses theme"| node_theme

click node_home "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/home/page.tsx"
click node_chat "https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatInterface.tsx"
click node_chatinput "https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatInput.tsx"
click node_chatmessage "https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatMessage.tsx"
click node_chatapi "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/api/chat/route.ts"
click node_medicines "https://github.com/sunnyshin8/magicmeds/blob/main/src/services/medicineDatabase.ts"
click node_ai_service "https://github.com/sunnyshin8/magicmeds/blob/main/src/services/googleAIStudio.ts"
click node_navbar "https://github.com/sunnyshin8/magicmeds/blob/main/src/components/NavBar.tsx"
click node_login "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/login/page.tsx"
click node_signup "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/signup/page.tsx"
click node_appointments "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/appointments/page.tsx"
click node_telehealth "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/telehealth/page.tsx"
click node_dashboard "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/dashboard/page.tsx"
click node_services "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/services/page.tsx"
click node_articles "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/articles/page.tsx"
click node_support "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/support/page.tsx"
click node_about "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/about/page.tsx"
click node_contact "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/contact/page.tsx"
click node_theme_registry "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/ThemeRegistry.tsx"
click node_theme "https://github.com/sunnyshin8/magicmeds/blob/main/src/app/theme.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_home,node_navbar,node_about,node_contact,node_user toneBlue
class node_login,node_signup,node_appointments,node_telehealth,node_dashboard,node_services,node_articles,node_support toneAmber
class node_chat,node_chatinput,node_chatmessage,node_chatapi,node_medicines,node_ai_service toneMint
class node_theme_registry,node_theme toneRose
class node_gemini toneIndigo
```

## Components

### User experience

- [Home page](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/home/page.tsx): `src/app/home/page.tsx`
- [Navigation](https://github.com/sunnyshin8/magicmeds/blob/main/src/components/NavBar.tsx): `src/components/NavBar.tsx`
- [About page](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/about/page.tsx): `src/app/about/page.tsx`
- [Contact](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/contact/page.tsx): `src/app/contact/page.tsx`

### Care features

- [Login](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Registration](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/signup/page.tsx): `src/app/signup/page.tsx`
- [Appointments](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/appointments/page.tsx): `src/app/appointments/page.tsx`
- [Telehealth](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/telehealth/page.tsx): `src/app/telehealth/page.tsx`
- [Health dashboard](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Service directory](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/services/page.tsx): `src/app/services/page.tsx`
- [Health articles](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/articles/page.tsx): `src/app/articles/page.tsx`
- [Support](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/support/page.tsx): `src/app/support/page.tsx`

### AI assistant

- [Chat interface](https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatInterface.tsx): `src/components/ChatInterface.tsx`
- [Chat input](https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatInput.tsx): `src/components/ChatInput.tsx`
- [Chat message](https://github.com/sunnyshin8/magicmeds/blob/main/src/components/ChatMessage.tsx): `src/components/ChatMessage.tsx`
- [Chat API](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/api/chat/route.ts): `src/app/api/chat/route.ts`
- [Medicine database](https://github.com/sunnyshin8/magicmeds/blob/main/src/services/medicineDatabase.ts): `src/services/medicineDatabase.ts`
- [Gemini service](https://github.com/sunnyshin8/magicmeds/blob/main/src/services/googleAIStudio.ts): `src/services/googleAIStudio.ts`

### Presentation layer

- [Theme registry](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/ThemeRegistry.tsx): `src/app/ThemeRegistry.tsx`
- [MUI theme](https://github.com/sunnyshin8/magicmeds/blob/main/src/app/theme.ts): `src/app/theme.ts`

### Other components

- **Healthcare user**
- **Google Gemini**

## Connections

- Healthcare user → Home page: opens (evidence: `README.md`)
- Home page → Chat interface: renders (evidence: `src/app/home/page.tsx`)
- Chat interface → Chat input: renders (evidence: `src/components/ChatInterface.tsx`)
- Chat interface → Chat message: renders (evidence: `src/components/ChatInterface.tsx`)
- Chat interface → Chat API: posts message (evidence: `src/components/ChatInterface.tsx`)
- Chat API → Medicine database: looks up symptoms (evidence: `src/app/api/chat/route.ts`)
- Chat API → Gemini service: requests response (evidence: `src/app/api/chat/route.ts`)
- Gemini service → Google Gemini: generates content (evidence: `src/services/googleAIStudio.ts`)
- Navigation → About page: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Home page: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Service directory: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Health articles: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Telehealth: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Appointments: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Health dashboard: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Contact: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Support: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Login: links to (evidence: `src/components/NavBar.tsx`)
- Navigation → Registration: links to (evidence: `src/components/NavBar.tsx`)
- Theme registry → MUI theme: uses theme (evidence: `src/app/ThemeRegistry.tsx`)
