# betheashvin/roomatch_fyp architecture

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

- Interactive diagram: https://gitdiagram.com/betheashvin/roomatch_fyp
- Repository: https://github.com/betheashvin/roomatch_fyp

## Overview

RooMatch is a furniture catalog and room-planning application. Users browse furniture, sign in or continue as a guest, arrange products in a room, validate fit, and save layouts to an account. The frontend also supports 2D/3D room editing and account dashboards; the backend provides catalog, authentication, saved-layout, and geometry-validation APIs. The source index supports the main frontend/backend links, but several UI and persistence details were not excerpted, so those relationships are omitted where unverified.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/lib/api.ts) (API client), [`frontend/src/editor/Editor.tsx`](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/Editor.tsx) (Room editor), [`frontend/src/App.tsx`](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/App.tsx) (Web routes), [`backend/app/services/catalog_repo.py`](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/catalog_repo.py) (Catalog repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Catalog discovery"]
  node_app["Web routes<br/>[App.tsx]"]
  node_catalog_ui["Furniture catalog<br/>[CatalogPage.tsx]"]
end

subgraph group_planning["Room planning"]
  node_studio["Room editor<br/>[Editor.tsx]"]
  node_editor_state["Editor state<br/>[useEditor.ts]"]
  node_canvas["Room canvas<br/>[RoomCanvas.tsx]"]
  node_scene3d["3D room view<br/>[RoomScene3D.tsx]"]
  node_studio_draft["Draft persistence<br/>[studioDraft.ts]"]
end

subgraph group_identity["Accounts and access"]
  node_auth_ui["Sign-in and registration<br/>[AuthPage.tsx]"]
  node_auth_context["Session context<br/>[AuthContext.tsx]"]
  node_dashboard["Saved-layout dashboard<br/>[Dashboard.tsx]"]
end

subgraph group_backend["Backend services"]
  node_catalog_api["Catalog API<br/>[catalog.py]"]
  node_catalog_repo["Catalog repository<br/>[catalog_repo.py]"]
  node_catalog_models["Catalog records<br/>[catalog.py]"]
  node_api_client["API client<br/>[api.ts]"]
  node_validate_route["Fit validation API<br/>[validate.py]"]
  node_geometry["Geometry engine<br/>[geometry_engine.py]"]
  node_layouts_route["Saved layouts API<br/>[layouts.py]"]
  node_layout_models["Layout records<br/>[saved_layout.py]"]
  node_auth_route["Authentication API<br/>[auth.py]"]
  node_auth_service["Session service<br/>[auth.py]"]
  node_email_service["Email delivery<br/>[email.py]"]
  node_db_config["Database access<br/>[database.py]"]
end

node_user(("Visitor or planner"))
node_database[("SQL database")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_studio
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_dashboard
node_catalog_ui -->|"fetches catalog"| node_api_client
node_api_client -.->|"requests catalog"| node_catalog_api
node_catalog_api -->|"queries"| node_catalog_repo
node_catalog_repo -->|"maps records"| node_catalog_models
node_catalog_repo -->|"uses sessions"| node_db_config
node_db_config -->|"connects"| node_database
node_studio -->|"manages state"| node_editor_state
node_studio -->|"renders"| node_canvas
node_studio -->|"renders"| node_scene3d
node_scene3d -->|"uses state"| node_editor_state
node_studio -->|"uses drafts"| node_studio_draft
node_studio -->|"calls API"| node_api_client
node_api_client -.->|"submits validation"| node_validate_route
node_validate_route -->|"validates placements"| node_geometry
node_validate_route -->|"loads products"| node_catalog_repo
node_studio -.->|"saves layouts"| node_api_client
node_api_client -.->|"requests layouts"| node_layouts_route
node_layouts_route -->|"reads and writes"| node_layout_models
node_layouts_route -->|"uses sessions"| node_db_config
node_auth_ui -->|"submits credentials"| node_api_client
node_auth_context -->|"checks session"| node_api_client
node_auth_context -->|"guards routes"| node_app
node_api_client -.->|"requests auth"| node_auth_route
node_auth_route -->|"uses sessions"| node_auth_service
node_auth_route -->|"sends email"| node_email_service
node_auth_service -->|"uses sessions"| node_db_config
node_dashboard -->|"loads layouts"| node_api_client

click node_app "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/App.tsx"
click node_catalog_ui "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/catalog/CatalogPage.tsx"
click node_catalog_api "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/catalog.py"
click node_catalog_repo "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/catalog_repo.py"
click node_catalog_models "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/models/catalog.py"
click node_studio "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/Editor.tsx"
click node_editor_state "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/useEditor.ts"
click node_canvas "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/RoomCanvas.tsx"
click node_scene3d "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/RoomScene3D.tsx"
click node_studio_draft "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/studioDraft.ts"
click node_api_client "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/lib/api.ts"
click node_validate_route "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/validate.py"
click node_geometry "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/geometry_engine.py"
click node_layouts_route "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/layouts.py"
click node_layout_models "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/models/saved_layout.py"
click node_auth_ui "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/auth/AuthPage.tsx"
click node_auth_context "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/auth/AuthContext.tsx"
click node_auth_route "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/auth.py"
click node_auth_service "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/auth.py"
click node_email_service "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/email.py"
click node_dashboard "https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/dashboard/Dashboard.tsx"
click node_db_config "https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/database.py"

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,node_catalog_ui toneBlue
class node_studio,node_editor_state,node_canvas,node_scene3d,node_studio_draft,node_database toneAmber
class node_auth_ui,node_auth_context,node_dashboard toneMint
class node_catalog_api,node_catalog_repo,node_catalog_models,node_api_client,node_validate_route,node_geometry,node_layouts_route,node_layout_models,node_auth_route,node_auth_service,node_email_service,node_db_config toneRose
class node_user toneIndigo
```

## Components

### Catalog discovery

- [Web routes](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Furniture catalog](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/catalog/CatalogPage.tsx): `frontend/src/catalog/CatalogPage.tsx`

### Room planning

- [Room editor](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/Editor.tsx): `frontend/src/editor/Editor.tsx`
- [Editor state](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/useEditor.ts): `frontend/src/editor/useEditor.ts`
- [Room canvas](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/RoomCanvas.tsx): `frontend/src/editor/RoomCanvas.tsx`
- [3D room view](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/RoomScene3D.tsx): `frontend/src/editor/RoomScene3D.tsx`
- [Draft persistence](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/editor/studioDraft.ts): `frontend/src/editor/studioDraft.ts`

### Accounts and access

- [Sign-in and registration](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/auth/AuthPage.tsx): `frontend/src/auth/AuthPage.tsx`
- [Session context](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/auth/AuthContext.tsx): `frontend/src/auth/AuthContext.tsx`
- [Saved-layout dashboard](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/dashboard/Dashboard.tsx): `frontend/src/dashboard/Dashboard.tsx`

### Backend services

- [Catalog API](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/catalog.py): `backend/app/routers/catalog.py`
- [Catalog repository](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/catalog_repo.py): `backend/app/services/catalog_repo.py`
- [Catalog records](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/models/catalog.py): `backend/app/models/catalog.py`
- [API client](https://github.com/betheashvin/roomatch_fyp/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Fit validation API](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/validate.py): `backend/app/routers/validate.py`
- [Geometry engine](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/geometry_engine.py): `backend/app/services/geometry_engine.py`
- [Saved layouts API](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/layouts.py): `backend/app/routers/layouts.py`
- [Layout records](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/models/saved_layout.py): `backend/app/models/saved_layout.py`
- [Authentication API](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Session service](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`
- [Email delivery](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/services/email.py): `backend/app/services/email.py`
- [Database access](https://github.com/betheashvin/roomatch_fyp/blob/main/backend/app/database.py): `backend/app/database.py`

### Other components

- **Visitor or planner**
- **SQL database**

## Connections

- Visitor or planner → Web routes: uses
- Web routes → Furniture catalog: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Room editor: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Sign-in and registration: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Saved-layout dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Furniture catalog → API client: fetches catalog (evidence: `frontend/src/catalog/CatalogPage.tsx`)
- API client → Catalog API: requests catalog
- Catalog API → Catalog repository: queries (evidence: `backend/app/routers/catalog.py`)
- Catalog repository → Catalog records: maps records (evidence: `backend/app/services/catalog_repo.py`)
- Catalog repository → Database access: uses sessions (evidence: `backend/app/services/catalog_repo.py`)
- Database access → SQL database: connects (evidence: `backend/app/database.py`)
- Room editor → Editor state: manages state (evidence: `frontend/src/editor/Editor.tsx`)
- Room editor → Room canvas: renders (evidence: `frontend/src/editor/Editor.tsx`)
- Room editor → 3D room view: renders (evidence: `frontend/src/editor/Editor.tsx`)
- 3D room view → Editor state: uses state (evidence: `frontend/src/editor/RoomScene3D.tsx`)
- Room editor → Draft persistence: uses drafts (evidence: `frontend/src/editor/Editor.tsx`)
- Room editor → API client: calls API (evidence: `frontend/src/editor/Editor.tsx`)
- API client → Fit validation API: submits validation
- Fit validation API → Geometry engine: validates placements (evidence: `backend/app/routers/validate.py`)
- Fit validation API → Catalog repository: loads products (evidence: `backend/app/routers/validate.py`)
- Room editor → API client: saves layouts (evidence: `frontend/src/editor/Editor.tsx`)
- API client → Saved layouts API: requests layouts
- Saved layouts API → Layout records: reads and writes (evidence: `backend/app/routers/layouts.py`)
- Saved layouts API → Database access: uses sessions (evidence: `backend/app/routers/layouts.py`)
- Sign-in and registration → API client: submits credentials (evidence: `frontend/src/auth/AuthPage.tsx`)
- Session context → API client: checks session (evidence: `frontend/src/auth/AuthContext.tsx`)
- Session context → Web routes: guards routes (evidence: `frontend/src/App.tsx`)
- API client → Authentication API: requests auth
- Authentication API → Session service: uses sessions (evidence: `backend/app/routers/auth.py`)
- Authentication API → Email delivery: sends email (evidence: `backend/app/routers/auth.py`)
- Session service → Database access: uses sessions (evidence: `backend/app/services/auth.py`)
- Saved-layout dashboard → API client: loads layouts (evidence: `frontend/src/dashboard/Dashboard.tsx`)
