# tanvirhassan-official/careloom-client architecture

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

- Interactive diagram: https://gitdiagram.com/tanvirhassan-official/careloom-client
- Repository: https://github.com/tanvirhassan-official/careloom-client

## Overview

1. **Overall shape**
   - Careloom here is a **Next.js App Router frontend**. The repository mainly contains the user-facing application: home page, doctor browsing, appointment details, auth screens, and dashboard screens.
   - The actual data/auth backend is mostly خارج this repo boundary; the README points to a separate **Careloom-server** repository.

2. **Primary runtime boundary**
   - `src/app` defines the route map, while most UI logic is pushed into `src/components/clientPages`.
   - That split suggests a clear separation between **route shells** and **page implementations**: app routes mount reusable client-page components rather than containing heavy logic directly.

3. **Route structure**
   - Public pages:
     - `/` home
     - `/appointments` doctor listing
     - `/appointments/category/[speciality]` specialty filtering
     - `/appointments/[id]` doctor detail / booking entry point
     - `/signin` and `/signup`
   - Protected/user pages:
     - `/dashboard`
   - Support routes:
     - `/api/auth/[...all]` for authentication handling
     - `not-found.jsx` for 404 behavior

4. **Doctor discovery subsystem**
   - The appointment browsing flow is the core product path.
   - `src/components/clientPages/Doctors.jsx`, `Specialists.jsx`, and `TopRatedDoctors.jsx` indicate multiple views into the same doctor catalog: full list, specialty-oriented views, and highlighted doctors on the home page.
   - `doctorCard.jsx` and the appointment route pages imply doctor records are rendered as reusable cards and then expanded into details pages.

5. **Appointment management subsystem**
   - The booking flow centers on `/appointments/[id]`, where a user likely sees a doctor profile and books a slot.
   - The dashboard contains `Appointments.jsx`, which likely supports **view/update/delete** of existing bookings, matching the README’s “My Bookings” behavior.
   - This is the main read/write domain in the app: doctor selection → booking creation → user-managed booking lifecycle.

6. **Authentication and session subsystem**
   - Authentication is handled through `src/lib/auth.js`, `src/lib/auth-client.js`, and the catch-all route `src/app/api/auth/[...all]/route.js`.
   - The README indicates **email/password, Google login, JWT sessions, and protected routes**, so auth is a first-class system boundary rather than a simple UI feature.
   - `GoogleLogin.jsx`, `Signin.jsx`, and `Signup.jsx` are the user entry points for this flow.

7. **Protected route / access control boundary**
   - `src/proxy.js` likely enforces route-level access control, redirecting unauthenticated users away from dashboard/booking areas and preserving intended destination after login.
   - This means the architecture separates **public browsing** from **authenticated booking management**, with auth gating applied centrally.

8. **Dashboard subsystem**
   - `src/components/clientPages/Dashboard.jsx` appears to be the dashboard shell.
   - The dashboard supports profile management and booking management, so it is the app’s authenticated workspace.
   - The dashboard is a consumer of the same underlying auth/session state and booking data as the public appointment pages, but with edit privileges.

9. **Home page and marketing/information layer**
   - `Banner.jsx`, `Why.jsx`, `Footer.jsx`, `Navbar.jsx`, and `Avatar.jsx` suggest a conventional landing-page layer that introduces the service and routes users into discovery or auth flows.
   - `src/components/page.jsx` and `TopRatedDoctors.jsx` likely compose the home page into sections emphasizing trust and featured doctors.

10. **Styling and UI system**
   - `globals.css`, `postcss.config.mjs`, and the README’s Tailwind/DaisyUI references indicate a utility-first styling setup with component-level responsiveness.
   - This affects the architecture mostly as a shared presentation layer rather than a data layer.

11. **External dependencies and service boundaries**
   - The frontend depends on an external API/backend for doctors, appointments, and user records; the separate server repo is the persistence and business-logic boundary.
   - Authentication is integrated through the app’s auth route and shared auth libraries, rather than being embedded directly in each page.

12. **Data flow summary**
   - Typical user flow:
     1. Visit home or appointments listing
     2. Filter/browse doctors by specialty
     3. Open doctor details
     4. Sign in/sign up if needed
     5. Book an appointment
     6. Manage bookings/profile in the dashboard
   - This creates a mostly linear flow with two important shared dependencies: **session state** and **backend-sourced doctor/appointment data**.

13. **Why this matters for an architecture diagram**
   - The clearest diagram should show:
     - A **Next.js frontend shell**
     - A **client-page UI layer**
     - A **route/auth boundary**
     - An **external backend/API/database boundary**
   - The central interactions are browsing doctors, authenticating users, and managing appointments, with the dashboard representing the authenticated control plane.

Main entry points: [`src/app/page.js`](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/page.js) (Home), [`src/app/layout.js`](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/layout.js) (App shell), [`src/lib/auth.js`](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/lib/auth.js) (Auth setup), [`src/components/doctorCard.jsx`](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/doctorCard.jsx) (Doctor card)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App routes"]
  node_layout["App shell<br/>Next layout<br/>[layout.js]"]
  node_home["Home<br/>landing route<br/>[page.js]"]
  node_appointments_route["Appointments<br/>listing route<br/>[page.jsx]"]
  node_specialty_route["Specialty filter<br/>filtered route<br/>[page.jsx]"]
  node_doctor_route["Doctor detail<br/>detail route<br/>[page.jsx]"]
  node_dashboard_route["Dashboard<br/>protected route<br/>[page.jsx]"]
  node_signin_route["Sign in<br/>auth route<br/>[page.jsx]"]
  node_signup_route["Sign up<br/>auth route<br/>[page.jsx]"]
end

subgraph group_ui["UI components"]
  node_page_components["Page sections<br/>landing components<br/>[page.jsx]"]
  node_doctors_view["Doctors view<br/>catalog component<br/>[Doctors.jsx]"]
  node_specialists_view["Specialists view<br/>catalog component<br/>[Specialists.jsx]"]
  node_top_rated["Top rated<br/>featured list"]
  node_doctor_card["Doctor card<br/>card component<br/>[doctorCard.jsx]"]
  node_appointments_ui["Bookings UI<br/>booking workspace<br/>[Appointments.jsx]"]
  node_dashboard_ui["Dashboard shell<br/>workspace component<br/>[Dashboard.jsx]"]
  node_signin_ui["Sign in UI<br/>auth form<br/>[Signin.jsx]"]
  node_signup_ui["Sign up UI<br/>auth form<br/>[Signup.jsx]"]
  node_google_login["Google login<br/>oauth button<br/>[GoogleLogin.jsx]"]
  node_navbar["Navbar<br/>site chrome<br/>[Navbar.jsx]"]
  node_banner["Banner<br/>hero section<br/>[Banner.jsx]"]
  node_why["Why careloom<br/>info section<br/>[Why.jsx]"]
  node_footer["Footer<br/>site chrome<br/>[Footer.jsx]"]
  node_avatar["Avatar<br/>profile widget<br/>[Avatar.jsx]"]
end

subgraph group_auth["Auth boundary"]
  node_auth_api["Auth API<br/>route handler<br/>[route.js]"]
  node_proxy["Access proxy<br/>route guard<br/>[proxy.js]"]
  node_auth_lib["Auth setup<br/>auth config<br/>[auth.js]"]
  node_auth_client["Client auth<br/>session client<br/>[auth-client.js]"]
end

subgraph group_shared["Shared assets"]
  node_styles["Global styles<br/>css layer<br/>[globals.css]"]
end

subgraph group_external["External backend"]
  node_backend[("Careloom server<br/>external backend")]
end

node_root["Careloom<br/>Next.js frontend"]

node_root -->|"uses"| node_layout
node_layout -->|"includes"| node_navbar
node_layout -->|"includes"| node_footer
node_layout -->|"loads"| node_styles
node_home -->|"composes"| node_page_components
node_home -->|"shows"| node_banner
node_home -->|"shows"| node_why
node_home -->|"shows"| node_top_rated
node_appointments_route -->|"renders"| node_doctors_view
node_specialty_route -->|"renders"| node_specialists_view
node_doctor_route -->|"uses"| node_doctor_card
node_dashboard_route -->|"renders"| node_dashboard_ui
node_dashboard_ui -->|"contains"| node_appointments_ui
node_signin_route -->|"renders"| node_signin_ui
node_signup_route -->|"renders"| node_signup_ui
node_signin_ui -->|"offers"| node_google_login
node_signup_ui -->|"offers"| node_google_login
node_auth_api -->|"uses"| node_auth_lib
node_auth_lib -->|"pairs with"| node_auth_client
node_proxy -->|"checks"| node_auth_lib
node_proxy -->|"protects"| node_dashboard_route
node_proxy -->|"protects"| node_doctor_route
node_doctors_view -->|"reuses"| node_doctor_card
node_specialists_view -->|"reuses"| node_doctor_card
node_top_rated -->|"reuses"| node_doctor_card
node_dashboard_ui -->|"shows"| node_avatar
node_doctors_view -->|"fetches"| node_backend
node_specialists_view -->|"fetches"| node_backend
node_doctor_route -->|"fetches"| node_backend
node_appointments_ui -->|"mutates"| node_backend
node_auth_lib -->|"depends on"| node_backend

click node_layout "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/layout.js"
click node_home "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/page.js"
click node_appointments_route "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/appointments/page.jsx"
click node_specialty_route "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/appointments/category/[speciality]/page.jsx"
click node_doctor_route "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/appointments/[id]/page.jsx"
click node_dashboard_route "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/dashboard/page.jsx"
click node_signin_route "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/signin/page.jsx"
click node_signup_route "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/signup/page.jsx"
click node_auth_api "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/api/auth/[...all]/route.js"
click node_proxy "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/proxy.js"
click node_auth_lib "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/lib/auth.js"
click node_auth_client "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/lib/auth-client.js"
click node_page_components "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/page.jsx"
click node_doctors_view "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Doctors.jsx"
click node_specialists_view "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Specialists.jsx"
click node_top_rated "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/TopRatedDoctors.jsx"
click node_doctor_card "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/doctorCard.jsx"
click node_appointments_ui "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Appointments.jsx"
click node_dashboard_ui "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Dashboard.jsx"
click node_signin_ui "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Signin.jsx"
click node_signup_ui "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Signup.jsx"
click node_google_login "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/GoogleLogin.jsx"
click node_navbar "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Navbar.jsx"
click node_banner "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Banner.jsx"
click node_why "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Why.jsx"
click node_footer "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Footer.jsx"
click node_avatar "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Avatar.jsx"
click node_styles "https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/globals.css"

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_layout,node_home,node_appointments_route,node_specialty_route,node_doctor_route,node_dashboard_route,node_signin_route,node_signup_route toneBlue
class node_page_components,node_doctors_view,node_specialists_view,node_top_rated,node_doctor_card,node_appointments_ui,node_dashboard_ui,node_signin_ui,node_signup_ui,node_google_login,node_navbar,node_banner,node_why,node_footer,node_avatar toneAmber
class node_auth_api,node_proxy,node_auth_lib,node_auth_client toneMint
class node_styles toneRose
class node_backend toneIndigo
class node_root toneNeutral
```

## Components

### App routes

Next.js App Router shells and route endpoints

- [App shell](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/layout.js): Next layout · Global document and shared app chrome · `src/app/layout.js`
- [Home](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/page.js): landing route · Public entry page for the product · `src/app/page.js`
- [Appointments](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/appointments/page.jsx): listing route · Doctor browsing entry point · `src/app/appointments/page.jsx`
- [Specialty filter](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/appointments/category/[speciality]/page.jsx): filtered route · Appointment browsing by speciality · `src/app/appointments/category/[speciality]/page.jsx`
- [Doctor detail](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/appointments/[id]/page.jsx): detail route · Doctor profile and booking entry point · `src/app/appointments/[id]/page.jsx`
- [Dashboard](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/dashboard/page.jsx): protected route · Authenticated workspace for profile and bookings · `src/app/dashboard/page.jsx`
- [Sign in](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/signin/page.jsx): auth route · User login entry page · `src/app/signin/page.jsx`
- [Sign up](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/signup/page.jsx): auth route · User registration entry page · `src/app/signup/page.jsx`

### UI components

Shared presentation and page-level client components

- [Page sections](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/page.jsx): landing components · Home page sections and shared marketing content · `src/components/page.jsx`
- [Doctors view](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Doctors.jsx): catalog component · Main doctor listing and browsing UI · `src/components/clientPages/Doctors.jsx`
- [Specialists view](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Specialists.jsx): catalog component · Specialty-oriented doctor discovery UI · `src/components/clientPages/Specialists.jsx`
- [Top rated](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/TopRatedDoctors.jsx): featured list · Highlighted doctors shown on the home page · `src/components/TopRatedDoctors.jsx`
- [Doctor card](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/doctorCard.jsx): card component · Reusable doctor summary card · `src/components/doctorCard.jsx`
- [Bookings UI](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Appointments.jsx): booking workspace · Appointment management interface in the dashboard · `src/components/clientPages/Appointments.jsx`
- [Dashboard shell](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Dashboard.jsx): workspace component · Authenticated dashboard container · `src/components/clientPages/Dashboard.jsx`
- [Sign in UI](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Signin.jsx): auth form · Login form and related actions · `src/components/clientPages/Signin.jsx`
- [Sign up UI](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/clientPages/Signup.jsx): auth form · Registration form and related actions · `src/components/clientPages/Signup.jsx`
- [Google login](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/GoogleLogin.jsx): oauth button · Third-party sign-in entry point · `src/components/GoogleLogin.jsx`
- [Navbar](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Navbar.jsx): site chrome · Primary navigation across public and auth flows · `src/components/Navbar.jsx`
- [Banner](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Banner.jsx): hero section · Home page hero content · `src/components/Banner.jsx`
- [Why careloom](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Why.jsx): info section · Value proposition and trust content · `src/components/Why.jsx`
- [Footer](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Footer.jsx): site chrome · Shared footer content · `src/components/Footer.jsx`
- [Avatar](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/components/Avatar.jsx): profile widget · User identity display component · `src/components/Avatar.jsx`

### Auth boundary

Authentication, session, and route protection

- [Auth API](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/api/auth/[...all]/route.js): route handler · Catch-all authentication endpoint · `src/app/api/auth/[...all]/route.js`
- [Access proxy](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/proxy.js): route guard · Route-level protection and redirect handling · `src/proxy.js`
- [Auth setup](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/lib/auth.js): auth config · Server-side authentication configuration · `src/lib/auth.js`
- [Client auth](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/lib/auth-client.js): session client · Browser-side authentication/session helpers · `src/lib/auth-client.js`

### Shared assets

Global styles and layout plumbing

- [Global styles](https://github.com/tanvirhassan-official/careloom-client/blob/main/src/app/globals.css): css layer · Application-wide styling foundation · `src/app/globals.css`

### External backend

Server-side data and persistence boundary outside this repo

- **Careloom server**: external backend · Separate backend repository providing data, appointments, and persistence

### Other components

- **Careloom**: Next.js frontend · Main client application for browsing doctors, signing in, and managing appointments

## Connections

- Careloom → App shell: uses · App-level shell wraps all routes
- App shell → Navbar: includes · Shared navigation is mounted in the shell
- App shell → Footer: includes · Shared footer is mounted in the shell
- App shell → Global styles: loads · Global styles apply across the app
- Home → Page sections: composes · Landing page assembles shared sections
- Home → Banner: shows · Hero section on the home page
- Home → Why careloom: shows · Trust and explanation section
- Home → Top rated: shows · Featured doctors section
- Appointments → Doctors view: renders · Main doctor browsing page delegates to client UI
- Specialty filter → Specialists view: renders · Specialty-filtered browsing delegates to client UI
- Doctor detail → Doctor card: uses · Doctor detail flow builds on reusable doctor representation
- Dashboard → Dashboard shell: renders · Dashboard route mounts the authenticated workspace
- Dashboard shell → Bookings UI: contains · Dashboard includes appointment management
- Sign in → Sign in UI: renders · Login route mounts the sign-in form
- Sign up → Sign up UI: renders · Registration route mounts the sign-up form
- Sign in UI → Google login: offers · Login UI supports Google authentication
- Sign up UI → Google login: offers · Registration UI supports Google authentication
- Auth API → Auth setup: uses · API route delegates to shared auth configuration
- Auth setup → Client auth: pairs with · Server and client auth layers share session behavior
- Access proxy → Auth setup: checks · Route protection depends on auth/session state
- Access proxy → Dashboard: protects · Dashboard access is gated by the proxy
- Access proxy → Doctor detail: protects · Booking-related routes are access-controlled
- Doctors view → Doctor card: reuses · Doctor list is rendered from cards
- Specialists view → Doctor card: reuses · Specialty views reuse the same doctor card
- Top rated → Doctor card: reuses · Featured doctors are shown with cards
- Dashboard shell → Avatar: shows · Dashboard likely displays the signed-in user identity
- Doctors view → Careloom server: fetches · Doctor catalog comes from the external server
- Specialists view → Careloom server: fetches · Specialty-filtered doctor data comes from the external server
- Doctor detail → Careloom server: fetches · Doctor detail and booking data are sourced externally
- Bookings UI → Careloom server: mutates · Booking management reads and updates appointment records
- Auth setup → Careloom server: depends on · Authentication relies on server-side user/session storage
