# catbouncexd/uas_frontend architecture

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

- Interactive diagram: https://gitdiagram.com/catbouncexd/uas_frontend
- Repository: https://github.com/catbouncexd/uas_frontend

## Overview

This is an E-Health/orthopaedic-center web application. The visible user workflow is public browsing, account registration or sign-in, then access to a protected dashboard and patient/resource areas. The repository also has surgery and visit-request routes, though their sampled pages are empty. Authentication is implemented with Better Auth and a Drizzle-backed database. Source evidence is strongest for authentication, the dashboard, patient data access, and resource cards; unsampled route behavior is not inferred.

Main entry points: [`src/db/index.ts`](https://github.com/catbouncexd/uas_frontend/blob/main/src/db/index.ts) (Database client), [`src/shared/components/ui`](https://github.com/catbouncexd/uas_frontend/tree/main/src/shared/components/ui) (Shared UI primitives), [`src/app/(auth)`](https://github.com/catbouncexd/uas_frontend/tree/main/src/app/(auth)) (Login and signup), [`src/lib/auth.ts`](https://github.com/catbouncexd/uas_frontend/blob/main/src/lib/auth.ts) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_public["Public pages<br/>[page.tsx]"]
  node_protectedlayout["Protected layout<br/>[layout.tsx]"]
  node_publiclayout["Public layout<br/>[layout.tsx]"]
  node_navigation["Navigation and footer"]
  node_ui["Shared UI primitives"]
end

subgraph group_identity["Identity"]
  node_authforms["Login and signup"]
  node_authclient["Auth client<br/>[auth-client.ts]"]
  node_authapi["Auth API route<br/>[route.ts]"]
  node_authservice["Auth service<br/>[auth.ts]"]
end

subgraph group_clinical["Clinical areas"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_doctorcard["Doctor card<br/>[DoctorCard.tsx]"]
  node_patientpage["Patient data page<br/>[page.tsx]"]
  node_patientroute["Patient route<br/>[page.tsx]"]
  node_resources["Resource page<br/>[page.tsx]"]
  node_resourcecards["Resource cards"]
  node_surgery["Surgery route<br/>[page.tsx]"]
  node_visit["Visit-request route<br/>[page.tsx]"]
end

subgraph group_data["Data layer"]
  node_dbclient["Database client<br/>[index.ts]"]
  node_schemas["Database schemas"]
  node_database[("Postgres database")]
end

node_visitor(("Visitor / patient"))

node_visitor -->|"browses"| node_public
node_visitor -->|"registers or signs in"| node_authforms
node_authforms -->|"submits credentials"| node_authclient
node_authapi -->|"dispatches auth"| node_authservice
node_authservice -->|"uses adapter"| node_dbclient
node_dbclient -->|"configures schema"| node_schemas
node_dbclient -->|"connects"| node_database
node_protectedlayout -->|"checks session"| node_authservice
node_dashboard -->|"renders"| node_doctorcard
node_patientpage -->|"queries data"| node_dbclient
node_patientpage -->|"uses schema"| node_schemas
node_resources -->|"renders"| node_resourcecards
node_publiclayout -->|"renders"| node_navigation
node_protectedlayout -->|"renders"| node_navigation
node_authforms -->|"uses controls"| node_ui
node_public -->|"uses controls"| node_ui
node_doctorcard -->|"uses primitives"| node_ui
node_resourcecards -->|"uses cards"| node_ui

click node_public "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(public)/page.tsx"
click node_authforms "https://github.com/catbouncexd/uas_frontend/tree/main/src/app/(auth)"
click node_authclient "https://github.com/catbouncexd/uas_frontend/blob/main/src/lib/auth-client.ts"
click node_authapi "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/api/auth/%5B...all%5D/route.ts"
click node_authservice "https://github.com/catbouncexd/uas_frontend/blob/main/src/lib/auth.ts"
click node_protectedlayout "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/layout.tsx"
click node_dashboard "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/dashboard/page.tsx"
click node_doctorcard "https://github.com/catbouncexd/uas_frontend/blob/main/src/features/doctors/components/DoctorCard.tsx"
click node_patientpage "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/pasien/page.tsx"
click node_patientroute "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/patient/page.tsx"
click node_resources "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/resource/page.tsx"
click node_resourcecards "https://github.com/catbouncexd/uas_frontend/tree/main/src/features/resources/components"
click node_surgery "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/surgery/page.tsx"
click node_visit "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/visit-request/page.tsx"
click node_publiclayout "https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(public)/layout.tsx"
click node_navigation "https://github.com/catbouncexd/uas_frontend/tree/main/src/shared/components"
click node_ui "https://github.com/catbouncexd/uas_frontend/tree/main/src/shared/components/ui"
click node_dbclient "https://github.com/catbouncexd/uas_frontend/blob/main/src/db/index.ts"
click node_schemas "https://github.com/catbouncexd/uas_frontend/tree/main/src/db"

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_public,node_protectedlayout,node_publiclayout,node_navigation,node_ui toneBlue
class node_authforms,node_authclient,node_authapi,node_authservice toneAmber
class node_dashboard,node_doctorcard,node_patientpage,node_patientroute,node_resources,node_resourcecards,node_surgery,node_visit toneMint
class node_dbclient,node_schemas,node_database toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Public pages](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(public)/page.tsx): `src/app/(public)/page.tsx`
- [Protected layout](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/layout.tsx): `src/app/(protected)/layout.tsx`
- [Public layout](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(public)/layout.tsx): `src/app/(public)/layout.tsx`
- [Navigation and footer](https://github.com/catbouncexd/uas_frontend/tree/main/src/shared/components): `src/shared/components`
- [Shared UI primitives](https://github.com/catbouncexd/uas_frontend/tree/main/src/shared/components/ui): `src/shared/components/ui`

### Identity

- [Login and signup](https://github.com/catbouncexd/uas_frontend/tree/main/src/app/(auth)): `src/app/(auth)`
- [Auth client](https://github.com/catbouncexd/uas_frontend/blob/main/src/lib/auth-client.ts): `src/lib/auth-client.ts`
- [Auth API route](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/api/auth/%5B...all%5D/route.ts): `src/app/api/auth/[...all]/route.ts`
- [Auth service](https://github.com/catbouncexd/uas_frontend/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Clinical areas

- [Dashboard](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/dashboard/page.tsx): `src/app/(protected)/dashboard/page.tsx`
- [Doctor card](https://github.com/catbouncexd/uas_frontend/blob/main/src/features/doctors/components/DoctorCard.tsx): `src/features/doctors/components/DoctorCard.tsx`
- [Patient data page](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/pasien/page.tsx): `src/app/(protected)/pasien/page.tsx`
- [Patient route](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/patient/page.tsx): `src/app/(protected)/patient/page.tsx`
- [Resource page](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/resource/page.tsx): `src/app/(protected)/resource/page.tsx`
- [Resource cards](https://github.com/catbouncexd/uas_frontend/tree/main/src/features/resources/components): `src/features/resources/components`
- [Surgery route](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/surgery/page.tsx): `src/app/(protected)/surgery/page.tsx`
- [Visit-request route](https://github.com/catbouncexd/uas_frontend/blob/main/src/app/(protected)/visit-request/page.tsx): `src/app/(protected)/visit-request/page.tsx`

### Data layer

- [Database client](https://github.com/catbouncexd/uas_frontend/blob/main/src/db/index.ts): `src/db/index.ts`
- [Database schemas](https://github.com/catbouncexd/uas_frontend/tree/main/src/db): `src/db`
- **Postgres database**

### Other components

- **Visitor / patient**

## Connections

- Visitor / patient → Public pages: browses (evidence: `src/app/(public)/page.tsx`)
- Visitor / patient → Login and signup: registers or signs in (evidence: `src/app/(auth)/register/page.tsx`)
- Login and signup → Auth client: submits credentials (evidence: `src/app/(auth)/register/page.tsx`)
- Auth API route → Auth service: dispatches auth (evidence: `src/app/api/auth/[...all]/route.ts`)
- Auth service → Database client: uses adapter (evidence: `src/lib/auth.ts`)
- Database client → Database schemas: configures schema (evidence: `src/db/index.ts`)
- Database client → Postgres database: connects (evidence: `src/db/index.ts`)
- Protected layout → Auth service: checks session (evidence: `src/app/(protected)/layout.tsx`)
- Dashboard → Doctor card: renders (evidence: `src/app/(protected)/dashboard/page.tsx`)
- Patient data page → Database client: queries data (evidence: `src/app/(protected)/pasien/page.tsx`)
- Patient data page → Database schemas: uses schema (evidence: `src/app/(protected)/pasien/page.tsx`)
- Resource page → Resource cards: renders (evidence: `src/app/(protected)/resource/page.tsx`)
- Public layout → Navigation and footer: renders (evidence: `src/app/(public)/layout.tsx`)
- Protected layout → Navigation and footer: renders (evidence: `src/app/(protected)/layout.tsx`)
- Login and signup → Shared UI primitives: uses controls (evidence: `src/app/(auth)/login/page.tsx`)
- Public pages → Shared UI primitives: uses controls (evidence: `src/app/(public)/page.tsx`)
- Doctor card → Shared UI primitives: uses primitives (evidence: `src/features/doctors/components/DoctorCard.tsx`)
- Resource cards → Shared UI primitives: uses cards (evidence: `src/features/resources/components/ArticleCard.tsx`)
