This document provides a detailed overview of Mezon's technical architecture and design decisions.
- Framework: React 18+ with TypeScript
- State Management: Redux Toolkit with RTK Query
- Routing: React Router v6
- Styling: Tailwind CSS with custom design system
- Build Tool: Nx with Webpack
- Purpose: Administrative dashboard for server management
- Features: User management, analytics, system monitoring
- Security: Role-based access control with JWT authentication
- Framework: Electron
- Features: Native system integration, auto-updates, offline support
- Platform: Cross-platform (Windows, macOS, Linux)
- Philosophy: Atomic design with stateless components
- Components: Base UI elements (buttons, inputs, modals)
- Styling: Design tokens and theme system
- Accessibility: WCAG 2.1 AA compliance
- Purpose: Stateful business logic components
- Architecture: Container/Presenter pattern
- Context: React Context for local state management
- Hooks: Custom hooks for component logic
- Domain Logic: Business rules and entities
- Utilities: Cross-platform utility functions
- Constants: Application-wide constants and enums
- Types: Shared TypeScript interfaces and types
- API Client: REST API communication
- WebSocket: Real-time communication
- Authentication: Token management and refresh
- Caching: Request/response caching strategies
- State Management: Redux Toolkit slices
- Async Operations: RTK Query for data fetching
- Selectors: Memoized state selectors
- Middleware: Custom middleware for logging and analytics
User Action → Action Creator → Reducer → Store → Component → UI
- Actions: Dispatched from components
- Async Thunks: Handle side effects and API calls
- Reducers: Update state immutably
- Selectors: Derive computed state
- Components: Subscribe to state changes
WebSocket Events → Socket Middleware → Action Dispatch → State Update → UI Refresh
apps/chat → libs/*
apps/admin → libs/*
apps/desktop → libs/*
libs/components → libs/ui
libs/components → libs/store
libs/components → libs/core
libs/store → libs/transports
libs/store → libs/utils
libs/store → libs/core
libs/transports → libs/core
libs/transports → libs/utils
❌ apps/chat → apps/admin
❌ libs/ui → libs/components
❌ libs/transports → libs/store
❌ Cross-platform lib dependencies
- Base URL: Configurable endpoint
- Authentication: JWT Bearer tokens
- Error Handling: Centralized error processing
- Caching: TTL-based response caching
- Rate Limiting: Client-side request throttling
- Protocol: WebSocket with Protocol Buffer serialization
- Reconnection: Automatic reconnection with exponential backoff
- Message Queue: Offline message queuing
- Heartbeat: Connection health monitoring
Component → Action → Thunk → API/Socket → Response → Reducer → State → Component
- Login Request: Credentials sent to auth endpoint
- Token Generation: JWT with refresh token
- Token Storage: Secure storage (httpOnly cookies for web)
- Token Refresh: Automatic refresh before expiration
- Session Management: Cross-tab session sync
- Encryption: TLS 1.3 for transport
- Message Encryption: End-to-end for private messages
- Input Validation: Client and server-side validation
- XSS Protection: Content Security Policy headers
- CSRF Protection: Double-submit cookie pattern
- Code Splitting: Route-based lazy loading
- Tree Shaking: Dead code elimination
- Module Federation: Micro-frontend architecture ready
- Asset Optimization: Image compression and WebP support
- Memoization: React.memo and useMemo
- Virtualization: Large list rendering optimization
- Debouncing: Input and API call optimization
- Caching: Multi-layer caching strategy
- Cleanup: useEffect cleanup functions
- Weak References: Prevent memory leaks
- Garbage Collection: Optimal object lifecycle management
- Performance Metrics: Web Vitals tracking
- Error Monitoring: Centralized error logging
- User Analytics: Privacy-compliant usage tracking
- Performance Profiling: React DevTools integration
- Monorepo Management: Shared tooling and configuration
- Dependency Graph: Intelligent build ordering
- Caching: Distributed computation caching
- Task Orchestration: Parallel task execution
Source Code → Type Check → Lint → Test → Build → Bundle → Deploy
- Development: Local development with hot reload
- Staging: Pre-production testing environment
- Production: Multi-region deployment
- Source Control: Git with feature branch workflow
- Testing: Automated unit and integration tests
- Building: Containerized builds with Docker
- Deployment: Blue-green deployment strategy
- Component Architecture: Modular and reusable
- State Management: Normalized state structure
- API Design: RESTful with GraphQL readiness
- Caching Strategy: CDN and browser caching
- Team Structure: Feature-based team organization
- Code Organization: Domain-driven directory structure
- Testing Strategy: Comprehensive test coverage
- Documentation: Living documentation practices
- Micro-frontends: Module federation implementation
- GraphQL: Migration from REST API
- Service Workers: Offline-first capabilities
- WebRTC: Direct peer-to-peer communication
- WebAssembly: Performance-critical operations
- React 19: Concurrent features adoption
- Next.js Migration: SSR and SSG capabilities
- Edge Computing: Edge function deployment
- AI Integration: Machine learning model integration
src/
├── components/ # Reusable UI components
├── pages/ # Route components
├── hooks/ # Custom React hooks
├── store/ # Redux slices and selectors
├── services/ # API and business logic
├── utils/ # Utility functions
├── types/ # TypeScript type definitions
└── constants/ # Application constants
- Components: PascalCase (e.g.,
MessageList) - Files: kebab-case (e.g.,
message-list.component.tsx) - Functions: camelCase (e.g.,
handleMessageSend) - Constants: SCREAMING_SNAKE_CASE (e.g.,
API_BASE_URL)
- Single Responsibility Principle for components
- Immutable state updates
- Comprehensive error boundaries
- Accessibility-first development
- Performance-conscious coding
For implementation details and development setup, see the Developer Guide.

