How zinebni/uconnect works
Project Type & Purpose
• UConnecte is a full-stack web application built with Laravel 10.x that provides a private social network for a university community.
• It follows the MVC pattern on the server, uses Blade for server-rendered views, and enriches UX with Tailwind CSS, Alpine.js, and Axios.
Top-Level Components (to include
a. Client Tier
• Browser UI – Blade-generated HTML/CSS/JS, Alpine.js for interactivity, Tailwind CSS for styling, Axios calls for async updates.
• Assets Server – Vite or Laravel Mix bundle endpoints serving JS/CSS/images.
b. Web/API Tier
• Laravel HTTP Kernel – routes (web.php, auth.php), middleware (session, auth, CSRF).
• Controllers – Auth, Post, Comment, Like, Follow, Message, Notification, Profile, Search, Dashboard.
• Service Layer – FriendSuggestionService, Queue jobs for notifications and emails.
• Events & Listeners – PostCreated → CreatePostNotification, CommentLiked → notification, UserFollowed → notification.
• Queue Worker – Laravel Queues with Redis backend.
c. Data Tier
• MySQL – persistent storage for users, posts, comments, likes, follows, messages, notifications.
• Redis – cache layer (session, cache), queue broker.
d. Real-Time Tier
• Pusher (WebSocket) – push notifications and live messaging to connected clients.
e. External/DevOps
• SMTP/Mail Service – sending verification and notification emails.
• Storage – local filesystem or S3 for uploaded media.
• Deployment – PHP-FPM/Nginx, .env config, bootstrap, cache.
Relationships & Data Flows
• Client → HTTP(S) → Laravel Router → Controller → Model → MySQL
• Controller → dispatch Event → Queue (Redis) → Worker → Listener → Notification stored → Pusher → Client WebSocket
• Client uses Axios to POST comments/likes → Controller returns JSON → UI update
• Controller reads/writes cache in Redis for sessions or heavy-used queries
• Assets requests served by Vite/Mix pipeline in public/ directory
Architectural Patterns & Principles
• MVC (Models, Views, Controllers)
• Event-driven notifications (Events & Listeners)
• Service layer abstraction for business logic (FriendSuggestionService)
• Asynchronous processing with queues
• Modular directory layout (app/Models, app/Http, app/Services, database migrations/seeders)
• Separation of concerns: Blade for HTML, Alpine.js/Axios for dynamic behaviors