How uglyoholioh/canvenient works
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: App.jsx App · main.py FastAPI app · api.js API client · __init__.py Models
Components 21
Frontend
React/Vite SPA and feature components
- App · Top-level screen and state coordinator for auth and onboarding flow
frontend/src/App.jsx - API client · Client-side bridge for backend requests
frontend/src/api.js - Login · Sign-in UI
frontend/src/components/LoginForm.jsx - Register · Account creation UI
frontend/src/components/RegisterForm.jsx - Onboarding · First-run setup and profile completion UI
frontend/src/components/OnboardingForm.jsx - Dashboard · Primary authenticated landing view
frontend/src/components/Dashboard.jsx - Task Board · Task management workspace
frontend/src/components/TaskManagerDashboard.jsx - Sidebar · Primary in-app navigation
frontend/src/components/Sidebar.jsx
Backend
FastAPI API, domain logic, and persistence
- FastAPI app · Application entrypoint wiring routes and runtime behavior
backend/main.py - Auth routes · Authentication and session flows
backend/routes/auth.py - Task routes · Task CRUD and task-centric operations
backend/routes/tasks.py - Category routes · Category management endpoints
backend/routes/categories.py - Module routes · Academic module endpoints
backend/routes/academic_modules.py - Canvas route · Boundary for Canvas data synchronization or ingestion
backend/routes/canvas.py - Schema · Request and response validation boundary
backend/schema.py - Security · Password and token handling helpers
backend/security.py - Dependencies · Shared injected services such as DB sessions and user context
backend/dependencies.py - Database · Connection and session management for persistence
backend/database.py - Models · Persistent entities for users, auth, tasks, categories, and modules
backend/models/__init__.py
External
Database and third-party integration boundaries
- PostgreSQL · Supabase-hosted relational datastore
- Canvas · Third-party academic integration boundary
Connections 30
- 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