How centtttt/connectfriend works
Project Type and Purpose
• This is a full-stack Laravel web application implementing typical social and transactional features:
• User authentication/registration (LoginController, RegisterController, etc.)
• User profiles and friend relationships (ProfileController, FriendProfileController)
• Real-time‐style messaging and notifications (MessageController, NotificationController)
• Payment and top-up flows (PaymentController, TopUpController)
• The file tree follows Laravel’s default MVC+structure: controllers under app/Http/Controllers, Eloquent models under app/Models, Blade views under resources/views, routes in routes/web.php, migrations in database/migrations, front-end assets in resources/js and resources/css, compiled via Vite/post-CSS/bootstrap.
Key Architectural Components
a. Client Tier
• Web browser (HTML/CSS/JS delivered by public/).
• Assets built by Vite (resources/js/app.js, resources/css/app.css) and Bootstrap.
b. Web Tier
• Web server (Apache/Nginx pointing to public/index.php).
• Laravel front‐controller (public/index.php ➔ bootstrap/app.php ➔ app/Http Kernel).
• Middleware pipeline (e.g., SetLocale, checkUserStatus).
• HTTP Controllers (Auth, Profile, Message, Payment, etc.).
c. Application Tier
• Service Container & Providers (app/Providers/AppServiceProvider).
• Eloquent ORM (app/Models + migrations).
• Blade templating engine (resources/views).
• Background jobs & queues (config/queue.php, Jobs table).
d. Data Tier
• Relational database (MySQL/PostgreSQL configured in config/database.php).
• File storage (local or cloud via config/filesystems.php for uploads/profile photos).
• Cache/session stores (Redis or DB via config/cache.php, config/session.php).
e. External Services
• Payment gateway (integration via config/services.php).
• Mail service (SMTP or third-party via config/mail.php).
• Optional SMS/Push for notifications.
Relationships and Interactions
• Client sends HTTP requests ➔ Web Server ➔ Laravel Kernel
• Kernel dispatches through Middleware ➔ Routes ➔ Controllers
• Controllers invoke Services/Repositories (business logic) ➔ Eloquent Models ➔ Database
• Controllers return Blade views or JSON API responses ➔ Client renders UI
• Certain operations enqueue Jobs ➔ Queue Worker processes jobs asynchronously
• File uploads stored in Storage ➔ can be served via public symlink
• PaymentController communicates with external payment gateway via HTTPS APIs
• NotificationController may push real-time events (e.g., Laravel Echo) or send emails
Architectural Patterns & Principles
• MVC: Separation of Models (app/Models), Views (resources/views), Controllers (app/Http/Controllers)
• Middleware pipeline for cross-cutting concerns (authentication, localization, feature flags)
• Service Container / Dependency Injection via Providers
• Repository/Service layer (if custom) for business logic separation
• Queue pattern for asynchronous tasks (emails, notifications, payment callbacks)
• Configuration‐over-convention: config/*.php holds environment‐specific settings