How tuankiet116/media_social_network works
Main Components
• Backend Framework: Laravel 8, which includes the core “app” folder (controllers, models, middleware, providers) and additional functionalities via Modules.
• Modular Structure: Two main modules – “Modules/Admin” and “Modules/User”. Each module contains its own configuration, controllers, services, routes, entities, migrations, views, assets, and tests.
• Frontend: Vue3 files in the “resources/js” directory, including components (for posts, messaging, communities, user settings, etc.), Vue routes, Vuex store management, SASS/CSS assets, and additional integration with libraries like CKEditor5.
• Database: Migrations and seeders (in “database/migrations” and “database/seeders”) for tables such as users, admins, posts, communities, comments, messages, notifications, video chat, etc.
• External Services & Components:
• Queue system (artisan queue:listen) for asynchronous operations.
• Storage (local file storage in “storage/app/public”) set up with a symbolic link and default images for avatars and backgrounds.
• Integration with Facebook Developer Console indicated by the README configuration requirements.
• Third-party assets like CKEditor5 for rich text editing.
File Structure to Extract Architectural Layers
• Presentation Layer:
• Laravel Blade views inside Modules (e.g., “Modules/User/Resources/views”) and in “resources/views”.
• Vue3 components inside “resources/js/components” that handle the interactive frontend.
• Application Layer:
• Controllers in both “app/Http/Controllers” and within each Module’s “Http/Controllers” handle request routing.
• Service classes (in “app/Services/…” and under Modules/User) manage business logic like notifications, messaging, posts, etc.
• Middleware for authentication and other cross-cutting concerns (e.g., “app/Http/Middleware” and module-specific middleware).
• Event handling, jobs, and policies (see Events, Policies, and Console directories) – capturing various interaction flows.
• Data Layer:
• Models in “app/Models”, along with migrations (in “database/migrations”) and seeders (in “database/seeders” and inside Modules).
• Eloquent relationships among users, posts, comments, notifications, etc.
• Infrastructure:
• Configuration files (in “config” folder) define environment settings, database connections, mail, services, and modules.
• Composer and npm package management files (composer.json, package.json) define dependencies.
• Dockerfile and .env.example for containerization and environment configuration.
• Public assets provided in “public” (entry point index.php, favicon, mix-manifest.json).
Depicting Relationships and Data Flow
• Backend as various intertwined modules:
• A central Laravel kernel that routes HTTP requests to controllers.
• Admin and User modules as separate bounded contexts that contain distinct MVC layers.
• Requests coming from the browser (client) to the Laravel router.
• Controllers invoking Service classes and Models.
• Event triggers (e.g., in the User module: MessageEvent, NotificationEvent, VideoChat events).
• Communication between the modules, such as common components (services, storage, queue, etc.)
• External calls (e.g., Facebook API integration) and asynchronous operations (via queues).
Architectural Patterns and Design Principles
• MVC Pattern: Separate concerns between Models, Views, and Controllers.
• Modularization: Use of “Modules” (Admin and User) clearly segregates responsibilities.
• Service-Oriented Components: Distinct service classes under “app/Services” handle business logic.
• RESTful Routing: Both the “web.php” and “api.php” files in modules and the primary “routes” folder dictate API endpoints.
• Event-driven Architecture: Use of Events to handle messages, notifications, and video chats.
• Clear separation of concerns between frontend assets (Vue components and resources) and backend processing (Laravel controllers, models, etc.).
Additional Recommendations
• Since the Modules are extensive, consider grouping sub-components within Admin and User modules (for example, group all controllers, then all routes, etc.) but also show how these groups interact with central components like the Laravel kernel and database.