mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-29 22:23:01 +00:00
- Introduced detailed architecture overview outlining system components and entry points. - Documented state management using Redux Toolkit and Redux-Persist, including store configuration and slice structures. - Described services layer architecture, detailing API client, socket service, and MTProto service functionalities. - Explained the Model Context Protocol (MCP) system, including tool categories and implementation examples. - Outlined routing structure and page components, emphasizing protected and public routes. - Organized reusable components by feature, detailing their structure and usage. - Provided insights into provider management for service lifecycle and shared state. This documentation enhances understanding of the application's structure and improves onboarding for new developers, ensuring clarity in the system's design and functionality.
3.5 KiB
3.5 KiB
Source Code Documentation
This documentation covers the /src folder structure of the Outsourced Crypto Community Platform.
Quick Reference
| Document | Description |
|---|---|
| Architecture Overview | High-level system architecture and provider chain |
| State Management | Redux Toolkit slices, persistence, and selectors |
| Services Layer | Singleton services (Socket.io, MTProto, API client) |
| MCP System | Model Context Protocol with 81 Telegram tools |
| Pages & Routing | Route definitions, guards, and page components |
| Components | Reusable UI components and settings modal system |
| Providers | React context providers and lifecycle management |
| Hooks & Utils | Custom hooks and utility functions |
File Count Summary
| Category | Files | Purpose |
|---|---|---|
| Entry & Configuration | 7 | App init, routing, styles, types |
| State Management | 13 | Redux slices, selectors, hooks |
| Providers | 3 | Socket, Telegram, User contexts |
| Services | 5 | Singleton API clients |
| Pages | 9 | Full-page route components |
| Components | 28 | Reusable UI + settings modal (16 files) |
| MCP Core | 14 | MCP interfaces, transport, logging |
| MCP Telegram Tools | 81 | Individual Telegram API operations |
| Hooks | 2 | Custom React hooks |
| Types | 2 | TypeScript interfaces |
| Utils | 4 | Config, deep link, URL utilities |
| Data | 1 | Static data (countries) |
| Assets | 10+ | Icons and images |
| TOTAL | 171+ | Complete frontend application |
Directory Structure
src/
├── App.tsx # Root component with provider chain
├── AppRoutes.tsx # Route definitions
├── main.tsx # Entry point
├── polyfills.ts # Node.js polyfills for browser
├── index.css # Global styles
│
├── store/ # Redux state management (13 files)
├── providers/ # Context providers (3 files)
├── services/ # Singleton services (5 files)
├── lib/mcp/ # MCP system (95+ files)
├── pages/ # Page components (9 files)
├── components/ # UI components (28 files)
├── hooks/ # Custom hooks (2 files)
├── types/ # TypeScript types (2 files)
├── utils/ # Utilities (4 files)
├── data/ # Static data (1 file)
└── assets/ # Icons and images
Key Architectural Decisions
- HashRouter over BrowserRouter - Required for Tauri deep link compatibility
- Redux Toolkit with Persistence - Robust state management with rehydration
- Singleton Services - Prevents connection leaks for Socket.io and MTProto
- Per-User State Scoping - Telegram/socket state keyed by user ID
- Portal-Based Settings Modal - URL routing without affecting main routes
- 81-Tool MCP System - Comprehensive Telegram API coverage
Getting Started
- Read Architecture Overview for the big picture
- Understand State Management for data flow
- Review Services Layer for backend communication
- Explore MCP System for AI tool integration
Documentation maintained by stevenbaba