# uglyoholioh/canvenient architecture

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

- Interactive diagram: https://gitdiagram.com/uglyoholioh/canvenient
- Repository: https://github.com/uglyoholioh/canvenient

## Overview

1. **High-level shape**
   - CanVenient is a two-tier app: a **React/Vite single-page frontend** and a **FastAPI backend**.
   - The frontend handles user interaction and rendering; the backend owns authentication, business logic, persistence, and external integrations.
   - Data is stored in **PostgreSQL on Supabase**, configured through `DATABASE_URL`.

2. **Frontend subsystem**
   - The frontend lives under `frontend/src` and is organized as a set of **feature components** rather than a large framework-specific module graph.
   - Key UI pieces include `LoginForm`, `RegisterForm`, `OnboardingForm`, `Dashboard`, `TaskManagerDashboard`, and `Sidebar`.
   - `App.jsx` appears to act as the top-level screen/router coordinator, deciding which view to show based on app state such as auth or onboarding status.

3. **Frontend-to-backend boundary**
   - `frontend/src/api.js` is the main client-side integration point with the server.
   - The README notes Vite proxies `/auth` requests to the backend during development, so authentication traffic is routed cleanly without hardcoding backend URLs in the UI.
   - The frontend does not appear to talk to the database directly; all persistent operations go through the backend API.

4. **Backend API layer**
   - `backend/main.py` is the FastAPI application entrypoint and likely wires together route modules, middleware, and startup behavior.
   - The backend exposes a small set of resource-focused routes under `backend/routes/`, which form the main API surface consumed by the frontend.
   - A `/health` endpoint is documented for liveness verification, which is useful as an operational boundary in the architecture.

5. **Domain routes and responsibility split**
   - `routes/auth.py` handles authentication and user session/token-related flows.
   - `routes/tasks.py`, `routes/categories.py`, and `routes/academic_modules.py` map to the app’s core task-management domain objects.
   - `routes/canvas.py` is the integration boundary for Canvas-related data ingestion or synchronization.

6. **Domain model layer**
   - `backend/models/` contains the persistent domain entities: `user`, `auth`, `task`, `category`, and `academic_module`.
   - These models represent the data shapes the API persists and queries, and they define the core relational structure of the app.
   - The presence of separate models for tasks, categories, and academic modules suggests the app organizes work items around NUS student context rather than generic todo lists.

7. **Schema and validation boundary**
   - `backend/schema.py` is the contract layer between HTTP requests/responses and the internal model layer.
   - This separation indicates FastAPI/Pydantic-style request validation and response shaping, keeping the route handlers from exposing raw database objects directly.
   - In the architecture diagram, this is the boundary between external API payloads and internal domain data.

8. **Persistence and dependency management**
   - `backend/database.py` is the database connection/session layer, and `backend/dependencies.py` likely provides injected dependencies such as DB sessions and authenticated user context.
   - This is the backend’s infrastructure boundary: routes depend on injected services rather than creating connections ad hoc.
   - The README’s Supabase PostgreSQL connection string confirms that persistence is externalized and environment-configured.

9. **Security and authentication flow**
   - `backend/security.py` holds auth-related primitives such as password handling, token creation/verification, or similar security helpers.
   - A likely end-to-end flow is: register/login on the frontend → auth route → security helpers validate/issue credentials → client stores auth state → subsequent task/category/module requests are authorized.
   - This makes authentication a cross-cutting concern shared by multiple API routes.

10. **Primary user journey**
   - The UI flow likely starts at `LoginForm` or `RegisterForm`, then moves through `OnboardingForm` for first-time setup, and finally into the dashboard/task management screens.
   - `TaskManagerDashboard` and `Sidebar` suggest the main operational workspace is a task-centric dashboard with navigation around categories or modules.
   - The backend supports that flow by exposing the domain objects needed to populate the dashboard after login.

11. **External integration boundary**
   - The only clearly represented external product integration in the tree is **Canvas**, handled through its own backend route.
   - In architecture terms, Canvas is not a frontend concern; it is an upstream data source or sync target isolated behind the backend API.
   - This keeps third-party API handling out of the browser and centralizes integration logic server-side.

12. **Tooling and runtime**
   - Backend runtime: **Python 3.10+**, served with **Uvicorn**.
   - Frontend runtime: **Node.js 18+**, built and served with **Vite**.
   - The separation of `pip`/virtualenv on the backend and `npm` on the frontend reinforces a clean service boundary between API and SPA.

13. **What to draw in an architecture diagram**
   - Show three main boxes: **React frontend**, **FastAPI backend**, and **Supabase PostgreSQL**.
   - Draw a distinct integration path from the backend to **Canvas**.
   - Put authentication/security, domain routes, and model/schema layers inside the backend boundary, and keep the frontend limited to UI state and HTTP calls through `api.js`.

Main entry points: [`frontend/src/App.jsx`](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/App.jsx) (App), [`backend/main.py`](https://github.com/uglyoholioh/canvenient/blob/main/backend/main.py) (FastAPI app), [`frontend/src/api.js`](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/api.js) (API client), [`backend/models/__init__.py`](https://github.com/uglyoholioh/canvenient/blob/main/backend/models/__init__.py) (Models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_app["App<br/>spa coordinator<br/>[App.jsx]"]
  node_frontend_api["API client<br/>http client<br/>[api.js]"]
  node_frontend_login["Login<br/>auth form<br/>[LoginForm.jsx]"]
  node_frontend_register["Register<br/>auth form<br/>[RegisterForm.jsx]"]
  node_frontend_onboarding["Onboarding<br/>setup form<br/>[OnboardingForm.jsx]"]
  node_frontend_dashboard["Dashboard<br/>overview screen<br/>[Dashboard.jsx]"]
  node_frontend_taskdash["Task Board<br/>workspace view"]
  node_frontend_sidebar["Sidebar<br/>navigation<br/>[Sidebar.jsx]"]
end

subgraph group_backend["Backend"]
  node_backend_main["FastAPI app<br/>api entrypoint<br/>[main.py]"]
  node_backend_auth["Auth routes<br/>route module<br/>[auth.py]"]
  node_backend_tasks["Task routes<br/>route module<br/>[tasks.py]"]
  node_backend_categories["Category routes<br/>route module<br/>[categories.py]"]
  node_backend_modules["Module routes<br/>route module"]
  node_backend_canvas["Canvas route<br/>integration route<br/>[canvas.py]"]
  node_backend_schema["Schema<br/>contract layer<br/>[schema.py]"]
  node_backend_security{{"Security<br/>auth primitives<br/>[security.py]"}}
  node_backend_deps["Dependencies<br/>injection layer<br/>[dependencies.py]"]
  node_backend_database[("Database<br/>db session layer<br/>[database.py]")]
  node_backend_models["Models<br/>[__init__.py]"]
end

subgraph group_external["External"]
  node_supabase_pg[("PostgreSQL<br/>external database")]
  node_canvas_api(("Canvas<br/>external system"))
end

node_frontend_app -->|"auth screen"| node_frontend_login
node_frontend_app -->|"signup screen"| node_frontend_register
node_frontend_app -->|"setup flow"| node_frontend_onboarding
node_frontend_app -->|"main view"| node_frontend_dashboard
node_frontend_app -->|"workspace"| node_frontend_taskdash
node_frontend_app -->|"navigation"| node_frontend_sidebar
node_frontend_login -->|"submit creds"| node_frontend_api
node_frontend_register -->|"create account"| node_frontend_api
node_frontend_onboarding -->|"save setup"| node_frontend_api
node_frontend_dashboard -->|"load data"| node_frontend_api
node_frontend_taskdash -->|"task ops"| node_frontend_api
node_frontend_api -->|"HTTP API"| node_backend_main
node_backend_main -->|"register routes"| node_backend_auth
node_backend_main -->|"register routes"| node_backend_tasks
node_backend_main -->|"register routes"| node_backend_categories
node_backend_main -->|"register routes"| node_backend_modules
node_backend_main -->|"register routes"| node_backend_canvas
node_backend_auth -->|"tokens"| node_backend_security
node_backend_auth -->|"validate payloads"| node_backend_schema
node_backend_tasks -->|"inject deps"| node_backend_deps
node_backend_categories -->|"inject deps"| node_backend_deps
node_backend_modules -->|"inject deps"| node_backend_deps
node_backend_canvas -->|"sync boundary"| node_canvas_api
node_backend_deps -->|"session"| node_backend_database
node_backend_database -->|"persist"| node_supabase_pg
node_backend_tasks -->|"domain data"| node_backend_models
node_backend_categories -->|"domain data"| node_backend_models
node_backend_modules -->|"domain data"| node_backend_models
node_backend_auth -->|"user data"| node_backend_models
node_backend_schema -->|"shape data"| node_backend_models

click node_frontend_app "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/App.jsx"
click node_frontend_api "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/api.js"
click node_frontend_login "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/LoginForm.jsx"
click node_frontend_register "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/RegisterForm.jsx"
click node_frontend_onboarding "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/OnboardingForm.jsx"
click node_frontend_dashboard "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/Dashboard.jsx"
click node_frontend_taskdash "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/TaskManagerDashboard.jsx"
click node_frontend_sidebar "https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/Sidebar.jsx"
click node_backend_main "https://github.com/uglyoholioh/canvenient/blob/main/backend/main.py"
click node_backend_auth "https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/auth.py"
click node_backend_tasks "https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/tasks.py"
click node_backend_categories "https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/categories.py"
click node_backend_modules "https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/academic_modules.py"
click node_backend_canvas "https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/canvas.py"
click node_backend_schema "https://github.com/uglyoholioh/canvenient/blob/main/backend/schema.py"
click node_backend_security "https://github.com/uglyoholioh/canvenient/blob/main/backend/security.py"
click node_backend_deps "https://github.com/uglyoholioh/canvenient/blob/main/backend/dependencies.py"
click node_backend_database "https://github.com/uglyoholioh/canvenient/blob/main/backend/database.py"
click node_backend_models "https://github.com/uglyoholioh/canvenient/blob/main/backend/models/__init__.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_frontend_app,node_frontend_api,node_frontend_login,node_frontend_register,node_frontend_onboarding,node_frontend_dashboard,node_frontend_taskdash,node_frontend_sidebar toneBlue
class node_backend_main,node_backend_auth,node_backend_tasks,node_backend_categories,node_backend_modules,node_backend_canvas,node_backend_schema,node_backend_security,node_backend_deps,node_backend_database,node_backend_models toneAmber
class node_supabase_pg,node_canvas_api toneMint
```

## Components

### Frontend

React/Vite SPA and feature components

- [App](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/App.jsx): spa coordinator · Top-level screen and state coordinator for auth and onboarding flow · `frontend/src/App.jsx`
- [API client](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/api.js): http client · Client-side bridge for backend requests · `frontend/src/api.js`
- [Login](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/LoginForm.jsx): auth form · Sign-in UI · `frontend/src/components/LoginForm.jsx`
- [Register](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/RegisterForm.jsx): auth form · Account creation UI · `frontend/src/components/RegisterForm.jsx`
- [Onboarding](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/OnboardingForm.jsx): setup form · First-run setup and profile completion UI · `frontend/src/components/OnboardingForm.jsx`
- [Dashboard](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/Dashboard.jsx): overview screen · Primary authenticated landing view · `frontend/src/components/Dashboard.jsx`
- [Task Board](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/TaskManagerDashboard.jsx): workspace view · Task management workspace · `frontend/src/components/TaskManagerDashboard.jsx`
- [Sidebar](https://github.com/uglyoholioh/canvenient/blob/main/frontend/src/components/Sidebar.jsx): navigation · Primary in-app navigation · `frontend/src/components/Sidebar.jsx`

### Backend

FastAPI API, domain logic, and persistence

- [FastAPI app](https://github.com/uglyoholioh/canvenient/blob/main/backend/main.py): api entrypoint · Application entrypoint wiring routes and runtime behavior · `backend/main.py`
- [Auth routes](https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/auth.py): route module · Authentication and session flows · `backend/routes/auth.py`
- [Task routes](https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/tasks.py): route module · Task CRUD and task-centric operations · `backend/routes/tasks.py`
- [Category routes](https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/categories.py): route module · Category management endpoints · `backend/routes/categories.py`
- [Module routes](https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/academic_modules.py): route module · Academic module endpoints · `backend/routes/academic_modules.py`
- [Canvas route](https://github.com/uglyoholioh/canvenient/blob/main/backend/routes/canvas.py): integration route · Boundary for Canvas data synchronization or ingestion · `backend/routes/canvas.py`
- [Schema](https://github.com/uglyoholioh/canvenient/blob/main/backend/schema.py): contract layer · Request and response validation boundary · `backend/schema.py`
- [Security](https://github.com/uglyoholioh/canvenient/blob/main/backend/security.py): auth primitives · Password and token handling helpers · `backend/security.py`
- [Dependencies](https://github.com/uglyoholioh/canvenient/blob/main/backend/dependencies.py): injection layer · Shared injected services such as DB sessions and user context · `backend/dependencies.py`
- [Database](https://github.com/uglyoholioh/canvenient/blob/main/backend/database.py): db session layer · Connection and session management for persistence · `backend/database.py`
- [Models](https://github.com/uglyoholioh/canvenient/blob/main/backend/models/__init__.py): domain models · Persistent entities for users, auth, tasks, categories, and modules · `backend/models/__init__.py`

### External

Database and third-party integration boundaries

- **PostgreSQL**: external database · Supabase-hosted relational datastore
- **Canvas**: external system · Third-party academic integration boundary

## Connections

- App → Login: auth screen · Chooses login view when unauthenticated
- App → Register: signup screen · Chooses registration view
- App → Onboarding: setup flow · Routes first-time users into onboarding
- App → Dashboard: main view · Shows the authenticated dashboard
- App → Task Board: workspace · Opens the task management workspace
- App → Sidebar: navigation · Composes the main shell with sidebar navigation
- Login → API client: submit creds · Sends login requests through the API client
- Register → API client: create account · Sends registration requests through the API client
- Onboarding → API client: save setup · Persists onboarding state through backend calls
- Dashboard → API client: load data · Fetches authenticated dashboard data
- Task Board → API client: task ops · Reads and updates task domain data
- API client → FastAPI app: HTTP API · Frontend talks to the FastAPI server through this boundary
- FastAPI app → Auth routes: register routes · Mounts auth endpoints
- FastAPI app → Task routes: register routes · Mounts task endpoints
- FastAPI app → Category routes: register routes · Mounts category endpoints
- FastAPI app → Module routes: register routes · Mounts academic module endpoints
- FastAPI app → Canvas route: register routes · Mounts Canvas integration endpoints
- Auth routes → Security: tokens · Uses security helpers for password and token handling
- Auth routes → Schema: validate payloads · Shapes auth requests and responses
- Task routes → Dependencies: inject deps · Uses shared database and user context dependencies
- Category routes → Dependencies: inject deps · Uses shared database and user context dependencies
- Module routes → Dependencies: inject deps · Uses shared database and user context dependencies
- Canvas route → Canvas: sync boundary · Talks to the external Canvas system
- Dependencies → Database: session · Provides database session access
- Database → PostgreSQL: persist · Connects to Supabase PostgreSQL via DATABASE_URL
- Task routes → Models: domain data · Reads and writes task entities
- Category routes → Models: domain data · Reads and writes category entities
- Module routes → Models: domain data · Reads and writes academic module entities
- Auth routes → Models: user data · Creates and queries user and auth records
- Schema → Models: shape data · Maps HTTP contracts to internal entities
