How muhasyraf/php-fullstack-test works
Main Components
• Client / Browser – Represents the end-user interface that interacts with the frontend.
• Frontend Layer – Built using Inertia.js and React (resources/js folder). This includes pages (e.g., login, register, client pages, profile management) and reusable components.
• Laravel Backend:
• Routes & Middleware – Include files in the “routes” folder and middleware (e.g., HandleInertiaRequests) that handle HTTP requests.
• Controllers – Organize requests into authentication (app/Http/Controllers/Auth), client management (app/Http/Controllers/MyClient), profile handling, etc.
• Services & Repositories – “app/Services/MyClient” and “app/Repositories/MyClient” handle business logic and data abstraction.
• Models – Represent the data layer for Users and MyClient (found in app/Models and its subfolders).
• Views – Blade templates (resources/views) that work in tandem with Inertia.
• Database – PostgreSQL serving as the primary data store, with migrations (under database/migrations) setting up tables.
• Cache and Session Store – Redis configured per the .env and config files.
• File Storage – External storage with Minio (or S3) integrated via Laravel’s filesystem configuration.
• External Interfaces – Other services that might be consumed (such as mailing services or external APIs) as configured in the project’s config.
Relationships and Interactions
• Data Flow:
• Client sends HTTP requests (or interacts via the Inertia-driven SPA UI).
• The request is routed through the middleware and defined routes to specific controllers.
• Controllers delegate business logic to the Service layer, which in turn interacts with Repositories to handle data persistence.
• The Models map directly to the PostgreSQL database.
• Caching/Session Flows:
• Redis is used for sessions and caching data between requests.
• File Handling:
• File uploads or asset management is performed via interactions with Minio (S3 storage), guided by configuration files.
• Authentication:
• A separate set of controllers, requests, and middleware handle the authentication layer, ensuring secure access to client data.
Important Architectural Patterns
• MVC (Model-View-Controller): Evident in the “app” directory with its Controllers, Models, and Views.
• Service and Repository Patterns: Clearly separated in the “app/Services” and “app/Repositories” directories to abstract and encapsulate business logic and data access.
• Integration with Inertia.js: This creates a reactive frontend experience while leveraging Laravel’s robust backend capabilities.
• Dependency Injection: Managed via Providers in “app/Providers” to bind interfaces (e.g., the MyClientRepositoryInterface) to concrete classes.