How yassiinneee/protask-manager works
Purpose and Entry Points
ProTask Manager is a full-stack task-management platform with authenticated task CRUD, administration, email verification, caching, and Gemini-assisted task drafting. The application server is rooted at server.js; React boots from client/src/main.jsx into client/src/App.jsx. REST endpoints are grouped below /api.
Client Application
The React/Vite client owns session-facing workflows: login/registration/verification, dashboard task interactions, settings, and admin UI. App.jsx coordinates major screen state; components render feature areas, while service modules isolate HTTP/auth/AI calls.
• client/src/App.jsx
• client/src/components/TaskList.jsx
• client/src/services/api.js
API Composition and Request Boundary
Express in server.js is the integration boundary for browser requests, API route mounting, health reporting, and development/production frontend serving. Routes dispatch to feature controllers, keeping HTTP definitions separate from business operations.
• server.js
• server/routes/taskRoutes.js
• server/controllers/taskController.js
Identity, Verification, and Administration
User operations include JWT-based login/logout, profile/password changes, OTP/email verification, and role-protected administrative user management. Authentication and authorization occur before protected controller operations; email delivery is delegated to a utility/provider boundary.
• server/routes/userRoutes.js
• server/middleware/authMiddleware.js
• server/utils/sendEmail.js
Task Domain and Persistence
Tasks and users are MongoDB/Mongoose document models. Task endpoints support owned/assigned task lifecycle operations plus filtering, pagination, and statistics; controllers enforce the application-facing ownership/authorization rules before persistence.
• server/models/Task.js
• server/models/User.js
• server/config/db.js
AI Assistance and Resilience
The AI assistant accepts task-generation/refinement requests from the client and routes them through a dedicated controller. It uses Google Gemini when configured, with local structured-template fallback when the external AI service/key is unavailable, preserving task-authoring functionality.
• client/src/components/AiTaskAssistant.jsx
• server/routes/aiRoutes.js
• server/controllers/aiController.js
Security and Cache Layers
Cross-cutting middleware supplies JWT protection, request validation, XSS sanitization, error handling, and the server-level security/rate-limit stack. Caching uses Redis when reachable and an in-memory fallback otherwise; cache operational endpoints expose stats/flush/test capabilities.
• server/middleware/validators.js
• server/middleware/xssMiddleware.js
• server/config/redis.js
Runtime and Deployment
Node.js 20+ runs Express; React 19/Vite builds the client. MongoDB is the primary store, Redis is optional cache infrastructure, Gemini and SMTP are external integrations. Development can serve Vite through Express; production builds a server bundle. Container deployment places Nginx ahead of the Node app, with Compose coordinating app, MongoDB, and Redis.
• docker-compose.yml
• nginx.conf
• vite.config.js
Main entry points: server.js Express server · App.jsx App shell · taskRoutes.js Task routes · userRoutes.js User routes
Components 22
React Client
- Vite entry
client/src/main.jsx - App shell
client/src/App.jsx - Task UI
client/src/components/TaskList.jsx - AI task assistant
client/src/components/AiTaskAssistant.jsx - Client API service
client/src/services/api.js
Node API
- Express server · Mounts APIs, health checks, and frontend serving.
server.js - Task routes
server/routes/taskRoutes.js - User routes
server/routes/userRoutes.js - AI routes
server/routes/aiRoutes.js - Auth middleware
server/middleware/authMiddleware.js - Validation & XSS
server/middleware/validators.js - Task controller · Enforces ownership and task lifecycle rules.
server/controllers/taskController.js - AI controller · Uses structured local fallback when Gemini is unavailable.
server/controllers/aiController.js - Email delivery
server/utils/sendEmail.js
Data & Integrations
- Task model
server/models/Task.js - User model
server/models/User.js - MongoDB
server/config/db.js - Redis cache · Falls back to in-memory cache when Redis is unreachable.
server/config/redis.js - Google Gemini
Deployment
- Nginx
nginx.conf - Compose deployment · Coordinates app, MongoDB, and Redis containers.
docker-compose.yml - Vite build config
vite.config.js
Connections 24
- Vite entry → App shell: boots
- App shell → Task UI: renders
- App shell → AI task assistant: renders
- Task UI → Client API service: task requests
- AI task assistant → Client API service: draft requests
- Client API service → Express server: REST /api
- Express server → Validation & XSS: applies
- Express server → Task routes: mounts
- Express server → User routes: mounts
- Express server → AI routes: mounts
- Task routes → Auth middleware: protects
- User routes → Auth middleware: protects admin/profile
- Task routes → Task controller: dispatches
- AI routes → AI controller: dispatches
- User routes → Email delivery: verification mail
- Task controller → Task model: reads/writes
- Auth middleware → User model: resolves users
- Task model → MongoDB: persists in
- User model → MongoDB: persists in
- Express server → Redis cache: uses
- AI controller → Google Gemini: generates when configured
- Nginx → Express server: proxies to
- Compose deployment → Nginx: deploys
- Vite build config → Vite entry: configures build