How vpatel95/mesapp works
Project Type and Purpose
• Type: Full‐stack web application
• Purpose: Real-time messaging (personal & group chat) with search functionality
• Key technologies: Laravel (PHP MVC framework), MySQL (Eloquent ORM), Vue.js (client), Pusher (real-time broadcasting), Elasticsearch (search engine)
Main Components
a. Client Side
– Browser (HTML/CSS/JavaScript)
– Vue.js components (resources/assets/js/components)
– Axios or built-in JS libs to call REST endpoints and subscribe to Pusher channels
b. Web/API Server
– Laravel application (routes, controllers, middleware)
– MVC layers:
• Controllers (ChatController, SearchController, Auth controllers, etc.)
• Models (User, Message, Chat, GroupChat, etc.)
• Views (Blade templates in resources/views)
– Repository pattern for Messages & Users (DatabaseMessageRepository, ElasticsearchMessageRepository)
– Console commands (ReindexMessages, ReindexUsers)
– Event system (MessageSent event → Broadcast via Pusher)
c. Data Stores
– MySQL database (primary message/user storage)
– Elasticsearch cluster (secondary index for search)
– File storage (local disk for downloads in storage/downloads)
d. External/Infrastructure Services
– Pusher (BROADCAST_DRIVER) for WebSocket/real-time push notifications
– NPM/Webpack (assets build pipeline via webpack.mix.js)
– Queue/Jobs (if configured; default Laravel queue)
Relationships & Data Flows
• User action in browser → HTTP(s) request to Laravel routes (web.php/api.php)
• ChatController → writes to MySQL via Eloquent or MessageRepository → triggers MessageSent event
• Event → broadcast to Pusher → pushes to all subscribed clients
• Clients listen on Pusher channels → update UI in real time
• Search request → SearchController calls ElasticsearchMessageRepository → returns results
• Console commands (artisan reindex:messages/users) → read from MySQL → write into Elasticsearch
• Static assets (CSS/JS) served from public/ directory
Architectural Patterns & Principles
• MVC (separation of concerns: controllers–models–views)
• Repository Pattern (abstract DB vs. Elasticsearch access)
• Event-Driven / Publish-Subscribe (Laravel Events + Pusher)
• Single Page App-ish behavior (Vue components for chat UI)
• Build Pipeline (Webpack + Laravel Mix)