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 tasks
  • themeStore - UI theme preferences
  • userStore - 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 updates
  • leave:project - Leave project room
  • task:create - Create new task
  • task:update - Update existing task
  • task:delete - Delete task

Server โ†’ Client:

  • task:created - New task created
  • task:updated - Task modified
  • task:deleted - Task removed
  • project:updated - Project modified
  • user:joined - User joined project
  • user: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.