Architecture Overview - anubissbe/ProjectHub-Mcp GitHub Wiki
Architecture Overview
This document provides a comprehensive overview of the ProjectHub-MCP v4.5.1 architecture, including system design, technology stack, and architectural decisions for this production-ready enterprise project management system.
๐๏ธ System Architecture
High-Level Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Backend โ โ Database โ
โ (React) โโโโโบโ (Node.js) โโโโโบโ (PostgreSQL) โ
โ Port: 5173 โ โ Port: 3001 โ โ Port: 5432 โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโบโ WebSocket โโโโโโโโโโโโโโโโ
โ (Socket.io) โ
โโโโโโโโโโโโโโโโโโโ
Component Architecture
Frontend (React)
โโโ Components/ # Reusable UI components
โโโ Pages/ # Page-level components
โโโ Services/ # API and external service calls
โโโ Store/ # State management (Zustand)
โโโ Hooks/ # Custom React hooks
โโโ Types/ # TypeScript type definitions
โโโ Utils/ # Utility functions
Backend (Node.js)
โโโ Controllers/ # Request handlers
โโโ Services/ # Business logic
โโโ Models/ # Data models
โโโ Routes/ # API route definitions
โโโ Middleware/ # Express middleware
โโโ Database/ # Database connection and queries
โโโ Utils/ # Utility functions
Database (PostgreSQL)
โโโ project_management/ # Project and task tables
โโโ knowledge_graph/ # Entities and relationships
โโโ rag/ # Document storage
โโโ vector_store/ # Vector embeddings
โโโ unified/ # General purpose storage
๐ป Technology Stack
Frontend Stack
Technology | Version | Purpose |
---|---|---|
React | 19.1.0 | Modern UI framework with concurrent features |
TypeScript | 5.8.3 | Type safety |
Vite | 6.3.5 | Build tool and dev server |
Tailwind CSS | 3.4.17 | Styling and design system |
Zustand | 5.0.0 | State management |
React Query | 5.17.9 | Server state management |
React Router | 6.21.1 | Client-side routing |
Socket.io Client | 4.7.4 | Real-time communication |
Recharts | 2.10.4 | Data visualization |
date-fns | 4.0.0 | Date manipulation |
Backend Stack
Technology | Version | Purpose |
---|---|---|
Node.js | 18+ | Runtime environment |
Express | 4.18.2 | Web framework |
TypeScript | 5.8.3 | Type safety |
Socket.io | 4.7.4 | Real-time communication |
pg | 8.11.3 | PostgreSQL client |
cors | 2.8.5 | Cross-origin resource sharing |
helmet | 7.1.0 | Security middleware |
compression | 1.7.4 | Response compression |
Database Stack
Technology | Version | Purpose |
---|---|---|
PostgreSQL | 17 | Primary database with advanced indexing |
pgvector | 0.5.1 | Vector similarity search for AI features |
Infrastructure Stack
Technology | Version | Purpose |
---|---|---|
Docker | 24+ | Containerization |
Docker Compose | 2.20+ | Multi-container orchestration |
Nginx | Alpine | Reverse proxy and load balancer |
GitHub Actions | - | CI/CD pipeline |
๐จ Frontend Architecture
Component Hierarchy
App
โโโ Layout
โ โโโ Navigation
โ โโโ Sidebar
โ โโโ Footer
โโโ Pages
โ โโโ ProjectList
โ โโโ ProjectDetail
โ โ โโโ TaskBoard (Kanban)
โ โ โโโ TaskList
โ โ โโโ CalendarView
โ โ โโโ TimelineView
โ โโโ Analytics
โโโ Modals
โ โโโ CreateTaskModal
โ โโโ EditTaskModal
โ โโโ TaskDetailModal
โโโ Common Components
โโโ TaskCard
โโโ TaskFilters
โโโ SearchBar
โโโ LoadingSpinner
State Management
Zustand Stores:
projectStore
- Current project and tasksthemeStore
- UI theme preferencesuserStore
- User session data (future)
React Query Cache:
- Projects data
- Tasks by project
- Analytics data
- Search results
Routing Structure
/ # Project list
/projects/:id # Project detail (default: board view)
/projects/:id/board # Kanban board view
/projects/:id/list # List view
/projects/:id/calendar # Calendar view
/projects/:id/timeline # Timeline/Gantt view
/analytics # Global analytics
/analytics/:projectId # Project-specific analytics
๐ฅ๏ธ Backend Architecture
API Layer Structure
Routes (API Endpoints)
โโโ /api/projects # Project CRUD operations
โโโ /api/tasks # Task CRUD operations
โโโ /api/analytics # Analytics and reporting
โโโ /api/export # Data export functionality
โโโ /api/search # Global search
โโโ /api/health # Health check endpoint
Controllers (Request Handlers)
โโโ ProjectController # Project business logic
โโโ TaskController # Task business logic
โโโ AnalyticsController # Analytics logic
โโโ ExportController # Export logic
Services (Business Logic)
โโโ ProjectService # Project operations
โโโ TaskService # Task operations
โโโ AnalyticsService # Data aggregation
โโโ SearchService # Search functionality
โโโ NotificationService # Real-time notifications
Database Layer
โโโ DatabaseConnection # PostgreSQL connection
โโโ QueryBuilder # Dynamic query building
โโโ Migrations # Database schema migrations
โโโ Seeders # Test data generation
Middleware Stack
Request Flow:
โโโโโโโโโโโโโโโโโโโ
โ HTTP Request โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ CORS โ Enable cross-origin requests
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Helmet โ Security headers
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Compression โ Gzip response compression
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Body Parser โ Parse JSON/URL-encoded bodies
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Authenticationโ JWT validation (future)
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Rate Limiting โ API rate limiting
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Route Handler โ Business logic
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Error Handler โ Global error handling
โโโโโโโโโโโโโโโโโโโ
๐๏ธ Database Architecture
Schema Design
-- Core project management schema
CREATE SCHEMA project_management;
-- Projects table
CREATE TABLE project_management.projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
description TEXT,
status VARCHAR(50) DEFAULT 'active',
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
-- Tasks table
CREATE TABLE project_management.tasks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
project_id UUID REFERENCES project_management.projects(id),
name VARCHAR(255) NOT NULL,
description TEXT,
status VARCHAR(50) DEFAULT 'pending',
priority VARCHAR(50) DEFAULT 'medium',
assignee VARCHAR(255),
due_date TIMESTAMP,
estimated_hours DECIMAL(5,2),
actual_hours DECIMAL(5,2),
tags TEXT[],
dependencies UUID[],
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
-- Indexes for performance
CREATE INDEX idx_tasks_project_id ON project_management.tasks(project_id);
CREATE INDEX idx_tasks_status ON project_management.tasks(status);
CREATE INDEX idx_tasks_assignee ON project_management.tasks(assignee);
CREATE INDEX idx_tasks_due_date ON project_management.tasks(due_date);
Vector Store Integration
-- Vector embeddings for advanced search
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE vector_store.task_embeddings (
id UUID PRIMARY KEY,
task_id UUID REFERENCES project_management.tasks(id),
embedding vector(1536),
content_type VARCHAR(50),
created_at TIMESTAMP DEFAULT NOW()
);
-- Vector similarity index
CREATE INDEX ON vector_store.task_embeddings
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100);
๐ Real-time Communication
WebSocket Architecture
Client (React) Server (Socket.io) Database
โ โ โ
โโโโโ connect โโโโโโโโโโโบโ โ
โ โ โ
โ โโโโโ task:update โโโโโโบโ
โโโโโ task:updated โโโโโโ โ
โ โ โ
โโโโโ join:project โโโโโโบโ โ
โ โ โ
โโโโโ task:create โโโโโโโบโโโโโ INSERT โโโโโโโโโโบโ
โโโโโ task:created โโโโโโโโโโโ RETURNING โโโโโโโ
โ โ โ
โ โโโโโ broadcast โโโโโโโบโ
โโโโโ task:created โโโโโโ to all clients โ
Event Types
Client โ Server:
join:project
- Join project room for updatesleave:project
- Leave project roomtask:create
- Create new tasktask:update
- Update existing tasktask:delete
- Delete task
Server โ Client:
task:created
- New task createdtask:updated
- Task modifiedtask:deleted
- Task removedproject:updated
- Project modifieduser:joined
- User joined projectuser:left
- User left project
๐ Security Architecture
Authentication Flow (Future Implementation)
1. User login request
โโโ Validate credentials
โโโ Generate JWT token
โโโ Return token + user data
2. Subsequent requests
โโโ Include JWT in Authorization header
โโโ Middleware validates token
โโโ Extract user info from token
โโโ Proceed with request
3. Token refresh
โโโ Check token expiration
โโโ Generate new token if needed
โโโ Return refreshed token
Security Measures
- CORS: Configured for specific origins
- Helmet: Security headers (CSP, HSTS, etc.)
- Rate Limiting: API request throttling
- Input Validation: Server-side validation
- SQL Injection Prevention: Parameterized queries
- XSS Prevention: Content sanitization
๐ Performance Architecture
Frontend Optimization
- Code Splitting: Route-based splitting with React.lazy()
- Bundle Analysis: Webpack bundle analyzer
- Tree Shaking: Unused code elimination
- Image Optimization: Lazy loading and compression
- Service Worker: Caching for offline support (future)
Backend Optimization
- Database Indexing: Strategic index placement
- Query Optimization: Efficient SQL queries
- Caching: Redis for session and query caching (future)
- Connection Pooling: PostgreSQL connection pool
- Compression: Gzip response compression
Database Optimization
- Indexing Strategy: Primary and secondary indexes
- Query Performance: EXPLAIN ANALYZE for optimization
- Connection Pooling: pgBouncer for connection management
- Partitioning: Table partitioning for large datasets (future)
๐ Deployment Architecture
Development Environment
Developer Machine
โโโ Frontend (Vite dev server)
โโโ Backend (Node.js with nodemon)
โโโ Database (Docker PostgreSQL)
โโโ Redis (Docker, future)
Production Environment
Production Server
โโโ Nginx (Reverse proxy)
โ โโโ SSL termination
โ โโโ Static file serving
โ โโโ Load balancing
โ โโโ Rate limiting
โโโ Frontend (Nginx static files)
โโโ Backend (Node.js cluster)
โโโ Database (PostgreSQL cluster)
โโโ Redis (Cluster mode)
CI/CD Pipeline
GitHub Repository
โโโ Push to main branch
โโโ GitHub Actions triggered
โโโ Run tests (frontend + backend)
โโโ Build Docker images
โโโ Push to container registry
โโโ Deploy to staging environment
โโโ Run E2E tests
โโโ Deploy to production
โโโ Health check verification
๐ Monitoring and Observability
Application Monitoring
- Health Checks:
/api/health
endpoint - Performance Metrics: Response times, throughput
- Error Tracking: Error rates and types
- User Analytics: Feature usage patterns
Infrastructure Monitoring
- Container Health: Docker container status
- Resource Usage: CPU, memory, disk utilization
- Database Performance: Query performance, connections
- Network Monitoring: Request/response patterns
Logging Strategy
Log Levels:
โโโ ERROR: System errors and exceptions
โโโ WARN: Warning conditions
โโโ INFO: General information
โโโ DEBUG: Detailed debugging information
โโโ TRACE: Very detailed trace information
Log Outputs:
โโโ Console (development)
โโโ File rotation (production)
โโโ Centralized logging (future: ELK stack)
โโโ Error reporting (future: Sentry)
๐ฎ Future Architecture Considerations
Scalability Improvements
- Microservices: Split into smaller services
- Message Queue: Redis/RabbitMQ for async processing
- Load Balancing: Multiple backend instances
- CDN: Static asset distribution
- Database Sharding: Horizontal database scaling
Feature Enhancements
- Offline Support: Service Worker implementation
- Mobile Apps: React Native or native apps
- API Gateway: Centralized API management
- Analytics Engine: Advanced reporting and insights
- AI Integration: Smart task recommendations
Security Enhancements
- OAuth Integration: Third-party authentication
- Role-Based Access: Granular permissions
- Audit Logging: Complete action tracking
- Data Encryption: At-rest and in-transit encryption
- Security Scanning: Automated vulnerability assessment
Next: Learn about Development Setup to start contributing to the project.