How saurabh21y/hyscaler works
Purpose and Entry Points
TaskFlow is a React/FastAPI project-management system for multi-user projects, task boards, comments, activity history, JWT authentication, and project-scoped real-time updates. Backend startup is backend/app/main.py; the SPA starts at frontend/src/main.jsx and composes routes/UI in frontend/src/App.jsx.
Frontend Application Shell
The Vite React client provides authenticated project, board, task, dashboard, assigned-task, team, and settings views. Shared authentication state keeps the short-lived access token in memory; UI components are presentation and interaction layers over server-owned data.
• frontend/src/context/AuthContext.jsx
• frontend/src/pages/ProjectPage.jsx
• frontend/src/pages/Dashboard.jsx
HTTP Client and Server-State Boundary
Axios centralizes REST communication and handles 401 refresh/retry behavior, while TanStack Query manages fetched server state and cache invalidation. The backend remains authoritative: filters, search, sorting, and pagination are performed by API endpoints rather than by loading all task records into the browser.
• frontend/src/api/axios.js
• backend/app/routers/tasks.py
• backend/app/routers/dashboard.py
FastAPI API and Domain Boundaries
FastAPI routers divide the API by domain: auth, projects/membership, tasks, comments, activity, cross-project assignment, dashboard, and WebSockets. Pydantic schemas define request/response contracts; service modules centralize project and activity operations where appropriate.
• backend/app/main.py
• backend/app/routers/projects.py
• backend/app/routers/tasks.py
• backend/app/services/project_service.py
• backend/app/services/activity_service.py
Identity, Authentication, and Authorization
The backend issues short-lived JWT access tokens and uses an httpOnly refresh cookie. Dependency/security layers validate identity and enforce protected access. Project membership and owner roles gate project actions; task status transitions add the specific “only assignee or owner may mark done” rule.
• backend/app/routers/auth.py
• backend/app/core/security.py
• backend/app/core/dependencies.py
• backend/app/routers/tasks.py
Persistence and Transactional Domain Effects
MongoDB is the persistence runtime, accessed through PyMongo initialization/session modules. Project, membership, task, comment, and activity records are stored and queried by routers/services. Mutations that generate audit events are intended to persist activity with the triggering operation; task changes also maintain completion timestamps and membership-dependent assignment validity.
• backend/app/db/mongo.py
• backend/app/db/session.py
• backend/app/services/activity_service.py
• backend/app/routers/comments.py
Real-Time Collaboration
A WebSocket endpoint authenticates a JWT passed in the connection URL, verifies project membership, and registers sockets in an in-memory project room manager. Mutating REST operations publish small project-scoped events; the client socket hook invalidates relevant query caches and refetches canonical REST data. The manager is single-process only; multi-worker deployment needs a shared backplane such as Redis pub/sub.
• backend/app/routers/ws.py
• backend/app/websockets/connection_manager.py
• frontend/src/ws/useProjectSocket.js
Runtime and Infrastructure
Backend runtime is Python 3.11+ with Uvicorn/FastAPI; frontend runtime is Node 18+ with Vite. Required external infrastructure is MongoDB 6+ or Atlas. Environment configuration supplies Mongo connection details, JWT/cookie policy, CORS origin, and frontend API/WS base URLs.
• backend/app/core/config.py
• backend/.env.example
• frontend/.env.example
• frontend/vite.config.js
Main entry points: main.py API application · tasks.py Tasks and board queries · mongo.py Mongo persistence · useProjectSocket.js Project socket hook
Components 18
React SPA
- SPA entry and routes · Composes authenticated project and workspace views.
frontend/src/main.jsx - Auth state · Keeps short-lived access token in memory.
frontend/src/context/AuthContext.jsx - HTTP client · Refreshes and retries requests after 401 responses.
frontend/src/api/axios.js - Server-state cache · Caches API data and refetches invalidated resources.
- Project and dashboard views
frontend/src/pages/ProjectPage.jsx - Project socket hook · Invalidates query caches when project events arrive.
frontend/src/ws/useProjectSocket.js
FastAPI backend
- API application · Startup point and router host.
backend/app/main.py - Authentication API · Issues JWT access tokens and refresh cookies.
backend/app/routers/auth.py - Identity and access control · Validates JWT identity, membership, and owner permissions.
backend/app/core/dependencies.py - Projects and membership · Manages projects, members, and owner-scoped actions.
backend/app/routers/projects.py - Tasks and board queries · Applies server-side filtering, sorting, pagination, and status rules.
backend/app/routers/tasks.py - Dashboard and assignments · Serves cross-project assignment and dashboard data.
backend/app/routers/dashboard.py - Comments
backend/app/routers/comments.py - Activity audit service · Persists activity generated by domain mutations.
backend/app/services/activity_service.py - Mongo persistence · Stores project, membership, task, comment, and activity records.
backend/app/db/mongo.py - Runtime configuration · Supplies Mongo, JWT/cookie, CORS, and API/WS settings.
backend/app/core/config.py
Real-time updates
- WebSocket endpoint · Authenticates connection JWTs and verifies project membership.
backend/app/routers/ws.py - Project room manager · Single-process project-scoped socket registry and publisher.
backend/app/websockets/connection_manager.py
Connections 26
- SPA entry and routes → Auth state: uses
- SPA entry and routes → Project and dashboard views: renders
- Project and dashboard views → Server-state cache: reads server state
- Server-state cache → HTTP client: fetches via
- Auth state → HTTP client: supplies access token
- HTTP client → API application: REST
- API application → Authentication API: routes
- API application → Projects and membership: routes
- API application → Tasks and board queries: routes
- API application → Dashboard and assignments: routes
- API application → Comments: routes
- Authentication API → Identity and access control: issues/validates tokens
- Projects and membership → Identity and access control: enforces membership
- Tasks and board queries → Identity and access control: enforces task permissions
- Projects and membership → Mongo persistence: persists
- Tasks and board queries → Mongo persistence: queries and mutates
- Comments → Mongo persistence: persists
- Tasks and board queries → Activity audit service: records mutations
- Comments → Activity audit service: records activity
- Activity audit service → Mongo persistence: writes audit events
- Project socket hook → WebSocket endpoint: project WebSocket
- WebSocket endpoint → Project room manager: registers connection
- Tasks and board queries → Project room manager: publishes project events
- Project room manager → Project socket hook: event notification
- Project socket hook → Server-state cache: invalidates and refetches
- Runtime configuration → API application: configures