How tauanmartins/backend-techarena-php works
Project type and purpose
• This is a monolithic PHP backend built with Laravel, serving as the core server for the “TechArena” application (a TCC project).
• It provides a RESTful API (routes in routes/api.php and routes/web.php), broadcast events (WebSockets), and integrates with AWS for storage or other services.
Main architectural components
a. API Layer (HTTP)
• Public/index.php → Laravel’s HTTP kernel → routing (app/Http/Controllers/*).
• Controllers grouped by domain (Appointments, Arena, Chat, Friend, Sport, Team, User, etc.).
• Middleware (authentication, CORS, CSRF, etc.).
b. Domain & Infrastructure Layers
• TechArena/Funcionalities/**: domain classes and interfaces for each business feature (User, Chat, Appointment, Arena, etc.).
• Infra/Model: Eloquent or domain models.
• Infra/Repository: Repository implementations (Database).
• ServiceProvider wiring (TechArena/Provider/ServiceProvider.php).
c. Database
• Relational DB (MySQL/PostgreSQL) – migrations under database/migrations and seeders under database/seeders.
• Tables for users, chats, messages, arenas, appointments, teams, preferences, permissions, etc.
d. Asynchronous / Real-Time
• Events (app/Events/NewMessage.php).
• Broadcasting / WebSockets configured in config/websockets.php.
• .devops/websocket Dockerfile runs laravel-websockets or similar.
e. Queues & Background Jobs
• config/queue.php – jobs for sending notifications, processing heavy tasks.
• Could use Redis or database queue driver.
f. External Services
• AWS integration (TechArena/Funcionalities/AWS/*).
• Other Laravel services (cache, mail, filesystems).
Relationships & Data Flows
• Client → Load Balancer / Reverse Proxy → PHP-FPM Container → Laravel Router → Controller → Domain Service → Repository → Database.
• Controllers dispatch events → Queue / Broadcast → WebSocket Server → Client (real-time updates).
• For AWS operations: Service calls from Domain → AWSRepository → AWS API.
Architectural patterns & principles
• MVC for HTTP layer (Controllers → Models → Views if any).
• Domain-Driven layering: separation between domain interfaces (TechArena/Funcionalities/*/Interfaces) and infrastructure implementations (Infra/Repository).
• Repository pattern for data access.
• Event-driven architecture for notifications & real-time communication.