# anang-programmer/sesuaidompet architecture

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

- Interactive diagram: https://gitdiagram.com/anang-programmer/sesuaidompet
- Repository: https://github.com/anang-programmer/sesuaidompet

## Overview

SesuaiDompet is a smartphone decision-support web app: users manage criteria and phone alternatives, set a budget and comparison set, then receive a ranked recommendation calculated with SAW. It also exposes the calculation steps, saved history, and SEDO AI for conversational phone lookup and recommendation explanations. The graph follows evidenced routing, data access, and calculation calls; the AI service-to-edge-function link is shown as unverified because the excerpts do not expose its invocation.

Main entry points: [`src/App.jsx`](https://github.com/anang-programmer/sesuaidompet/blob/main/src/App.jsx) (Routes and providers), [`src/services/spkService.js`](https://github.com/anang-programmer/sesuaidompet/blob/main/src/services/spkService.js) (SPK data service), [`src/hooks/useSawExecution.js`](https://github.com/anang-programmer/sesuaidompet/blob/main/src/hooks/useSawExecution.js) (SAW execution hook), [`src/pages/SedoAI.jsx`](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/SedoAI.jsx) (SEDO AI assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_routes["Routes and providers<br/>[App.jsx]"]
  node_auth["Authentication provider<br/>[AuthProvider.jsx]"]
  node_authhook["Auth context hook<br/>[useAuth.js]"]
  node_login["Login and registration<br/>[Login.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_decision["Decision workflow"]
  node_criteria["Criteria management<br/>[Kriteria.jsx]"]
  node_phones["Phone alternatives<br/>[Alternatif.jsx]"]
  node_assessment["Phone assessment<br/>[Penilaian.jsx]"]
  node_comparison["Budget comparison<br/>[Bandingkan.jsx]"]
  node_execution["SAW execution hook<br/>[useSawExecution.js]"]
  node_steps["Calculation breakdown<br/>[Perhitungan.jsx]"]
  node_results["Ranked results<br/>[Hasil.jsx]"]
  node_history["Calculation history<br/>[Riwayat.jsx]"]
end

subgraph group_data["Data and calculation"]
  node_calculation["SAW calculator<br/>[sawCalculator.js]"]
  node_service["SPK data service<br/>[spkService.js]"]
  node_supabase["Supabase client<br/>[supabase.js]"]
  node_database[("Supabase data store")]
end

subgraph group_ai["SEDO AI"]
  node_sedo["SEDO AI assistant<br/>[SedoAI.jsx]"]
  node_ai_service["AI service<br/>[sedoAiService.js]"]
  node_ai_function["SEDO AI edge function<br/>[index.ts]"]
  node_markdown["Markdown renderer"]
end

node_user(("User"))

node_user -->|"uses app"| node_routes
node_routes -->|"wraps routes"| node_auth
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_criteria
node_routes -->|"routes to"| node_phones
node_routes -->|"routes to"| node_assessment
node_routes -->|"routes to"| node_comparison
node_routes -->|"routes to"| node_steps
node_routes -->|"routes to"| node_results
node_routes -->|"routes to"| node_history
node_routes -->|"routes to"| node_sedo
node_user -->|"signs in"| node_login
node_login -->|"uses auth"| node_authhook
node_auth -->|"uses client"| node_supabase
node_criteria -->|"loads and updates"| node_service
node_phones -->|"manages phones"| node_service
node_assessment -->|"loads phone data"| node_service
node_comparison -->|"runs comparison"| node_execution
node_execution -->|"fetches inputs"| node_service
node_execution -->|"calculates ranking"| node_calculation
node_steps -->|"uses results"| node_execution
node_results -->|"uses results"| node_execution
node_history -->|"loads history"| node_service
node_service -->|"queries through"| node_supabase
node_supabase -->|"reads and writes"| node_database
node_sedo -->|"requests AI tasks"| node_ai_service
node_sedo -->|"loads and saves phones"| node_service
node_ai_service -.->|"invokes function"| node_ai_function
node_sedo -->|"renders responses"| node_markdown

click node_routes "https://github.com/anang-programmer/sesuaidompet/blob/main/src/App.jsx"
click node_auth "https://github.com/anang-programmer/sesuaidompet/blob/main/src/context/AuthProvider.jsx"
click node_authhook "https://github.com/anang-programmer/sesuaidompet/blob/main/src/hooks/useAuth.js"
click node_login "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Login.jsx"
click node_dashboard "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Dashboard.jsx"
click node_criteria "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Kriteria.jsx"
click node_phones "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Alternatif.jsx"
click node_assessment "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Penilaian.jsx"
click node_comparison "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Bandingkan.jsx"
click node_execution "https://github.com/anang-programmer/sesuaidompet/blob/main/src/hooks/useSawExecution.js"
click node_calculation "https://github.com/anang-programmer/sesuaidompet/blob/main/src/utils/sawCalculator.js"
click node_steps "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Perhitungan.jsx"
click node_results "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Hasil.jsx"
click node_history "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Riwayat.jsx"
click node_service "https://github.com/anang-programmer/sesuaidompet/blob/main/src/services/spkService.js"
click node_supabase "https://github.com/anang-programmer/sesuaidompet/blob/main/src/lib/supabase.js"
click node_sedo "https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/SedoAI.jsx"
click node_ai_service "https://github.com/anang-programmer/sesuaidompet/blob/main/src/services/sedoAiService.js"
click node_ai_function "https://github.com/anang-programmer/sesuaidompet/blob/main/supabase/functions/sedo-ai/index.ts"
click node_markdown "https://github.com/anang-programmer/sesuaidompet/blob/main/src/components/MarkdownRenderer.jsx"

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_routes,node_auth,node_authhook,node_login,node_dashboard,node_user toneBlue
class node_criteria,node_phones,node_assessment,node_comparison,node_execution,node_steps,node_results,node_history toneAmber
class node_calculation,node_service,node_supabase,node_database toneMint
class node_sedo,node_ai_service,node_ai_function,node_markdown toneRose
```

## Components

### Application

- [Routes and providers](https://github.com/anang-programmer/sesuaidompet/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication provider](https://github.com/anang-programmer/sesuaidompet/blob/main/src/context/AuthProvider.jsx): `src/context/AuthProvider.jsx`
- [Auth context hook](https://github.com/anang-programmer/sesuaidompet/blob/main/src/hooks/useAuth.js): `src/hooks/useAuth.js`
- [Login and registration](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Dashboard](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`

### Decision workflow

- [Criteria management](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Kriteria.jsx): `src/pages/Kriteria.jsx`
- [Phone alternatives](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Alternatif.jsx): `src/pages/Alternatif.jsx`
- [Phone assessment](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Penilaian.jsx): `src/pages/Penilaian.jsx`
- [Budget comparison](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Bandingkan.jsx): `src/pages/Bandingkan.jsx`
- [SAW execution hook](https://github.com/anang-programmer/sesuaidompet/blob/main/src/hooks/useSawExecution.js): `src/hooks/useSawExecution.js`
- [Calculation breakdown](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Perhitungan.jsx): `src/pages/Perhitungan.jsx`
- [Ranked results](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Hasil.jsx): `src/pages/Hasil.jsx`
- [Calculation history](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/Riwayat.jsx): `src/pages/Riwayat.jsx`

### Data and calculation

- [SAW calculator](https://github.com/anang-programmer/sesuaidompet/blob/main/src/utils/sawCalculator.js): `src/utils/sawCalculator.js`
- [SPK data service](https://github.com/anang-programmer/sesuaidompet/blob/main/src/services/spkService.js): `src/services/spkService.js`
- [Supabase client](https://github.com/anang-programmer/sesuaidompet/blob/main/src/lib/supabase.js): `src/lib/supabase.js`
- **Supabase data store**

### SEDO AI

- [SEDO AI assistant](https://github.com/anang-programmer/sesuaidompet/blob/main/src/pages/SedoAI.jsx): `src/pages/SedoAI.jsx`
- [AI service](https://github.com/anang-programmer/sesuaidompet/blob/main/src/services/sedoAiService.js): `src/services/sedoAiService.js`
- [SEDO AI edge function](https://github.com/anang-programmer/sesuaidompet/blob/main/supabase/functions/sedo-ai/index.ts): `supabase/functions/sedo-ai/index.ts`
- [Markdown renderer](https://github.com/anang-programmer/sesuaidompet/blob/main/src/components/MarkdownRenderer.jsx): `src/components/MarkdownRenderer.jsx`

### Other components

- **User**

## Connections

- User → Routes and providers: uses app (evidence: `src/App.jsx`)
- Routes and providers → Authentication provider: wraps routes (evidence: `src/App.jsx`)
- Routes and providers → Dashboard: routes to (evidence: `src/App.jsx`)
- Routes and providers → Criteria management: routes to (evidence: `src/App.jsx`)
- Routes and providers → Phone alternatives: routes to (evidence: `src/App.jsx`)
- Routes and providers → Phone assessment: routes to (evidence: `src/App.jsx`)
- Routes and providers → Budget comparison: routes to (evidence: `src/App.jsx`)
- Routes and providers → Calculation breakdown: routes to (evidence: `src/App.jsx`)
- Routes and providers → Ranked results: routes to (evidence: `src/App.jsx`)
- Routes and providers → Calculation history: routes to (evidence: `src/App.jsx`)
- Routes and providers → SEDO AI assistant: routes to (evidence: `src/App.jsx`)
- User → Login and registration: signs in
- Login and registration → Auth context hook: uses auth (evidence: `src/pages/Login.jsx`)
- Authentication provider → Supabase client: uses client (evidence: `src/context/AuthProvider.jsx`)
- Criteria management → SPK data service: loads and updates (evidence: `src/pages/Kriteria.jsx`)
- Phone alternatives → SPK data service: manages phones (evidence: `src/pages/Alternatif.jsx`)
- Phone assessment → SPK data service: loads phone data (evidence: `src/pages/Penilaian.jsx`)
- Budget comparison → SAW execution hook: runs comparison (evidence: `src/pages/Bandingkan.jsx`)
- SAW execution hook → SPK data service: fetches inputs (evidence: `src/hooks/useSawExecution.js`)
- SAW execution hook → SAW calculator: calculates ranking (evidence: `src/hooks/useSawExecution.js`)
- Calculation breakdown → SAW execution hook: uses results (evidence: `src/pages/Perhitungan.jsx`)
- Ranked results → SAW execution hook: uses results (evidence: `src/pages/Hasil.jsx`)
- Calculation history → SPK data service: loads history (evidence: `src/pages/Riwayat.jsx`)
- SPK data service → Supabase client: queries through (evidence: `src/services/spkService.js`)
- Supabase client → Supabase data store: reads and writes
- SEDO AI assistant → AI service: requests AI tasks (evidence: `src/pages/SedoAI.jsx`)
- SEDO AI assistant → SPK data service: loads and saves phones (evidence: `src/pages/SedoAI.jsx`)
- AI service → SEDO AI edge function: invokes function
- SEDO AI assistant → Markdown renderer: renders responses (evidence: `src/pages/SedoAI.jsx`)
