How kuaifan/dootask works
Main Components
• Client Layer:
• Web/Mobile Browser clients and/or Electron (desktop) clients.
• Static assets (in “public/”, “resources/assets/js” and compiled bundles via Vite) that drive the UI.
• API Gateway / Web Server:
• Nginx container (configured in docker/nginx) to serve static assets, handle HTTPS, proxy API requests.
• Application (Backend) Layer:
• Laravel Application: Contains controllers (in app/Http/Controllers), middleware, models, events, tasks, services, observers, and providers.
• API endpoints organized under “api” (in app/Http/Controllers/Api) for various operations (e.g., approve, complaint, dialog, project, report, etc.).
• Artisan commands and custom scripts found in the “cmd” and “bin” directories to control the service (start, stop, install, update, SSL configuration, etc.).
• Data & Storage Layer:
• MySQL container (docker/mysql) running the database with migrations (in database/migrations) and seeders.
• File storage (storage folder) for uploads and application data.
• Caching & Queue/Other Services:
• Redis/Queue could be part of the Laravel setup (if used, as referenced in configuration files and the command shortcuts).
• Elasticsearch container (docker/es) used to sync or handle search indexing, as referenced by modules like ElasticSearch in the app/Module folder.
• Additional Modules / External Services:
• WebSocket Service (app/Services/WebSocketService.php and corresponding models under app/Models) for real-time features.
• AgoraIO module (in app/Module/AgoraIO) for audio/video integrations.
• LDAP integration for user authentication (see app/Ldap).
• Docker and Supervisor setups (provided in docker/*, cmd, and artisan) to manage tasks and background jobs.
Relationships and Interactions
• Clients interact over the internet by sending HTTP/HTTPS (or WSS for WebSocket) requests.
• The Nginx container routes requests to the PHP (Laravel) backend. SSL and proxy configurations are handled here.
• The Laravel application processes API requests via its controllers, interacts with the database (MySQL) for persistent storage, and calls auxiliary modules/services (Redis, Elasticsearch, WebSocket services) as needed.
• Background tasks and scheduled jobs (located in app/Tasks) are executed to perform operations like sending notifications, cleaning up data, or synchronizing data (e.g., SyncDialogUserMsgToElasticsearch).
• The Electron client (under the electron directory) and potential mobile views share similar backend APIs or use the same WebSocket service for real-time updates.
Architectural Patterns/Design Principles to Highlight
• Layered Architecture: Separate front-end, API, business logic, and data storage.
• Modular Design: Modules (like AgoraIO, ElasticSearch, IpAddr, etc.) encapsulate specific functionality.
• Event-Driven: Observers, events (in app/Events) and tasks indicate asynchronous processing and decoupled interactions.
• Containerization: Use of Docker for isolating services (web server, database, search engine, office, etc.) allowing reproducible and scalable deployments.