How lmarcho/azbow-home-connect-crm works
Main Components
• API Gateway & HTTP Layer: At the “public/index.php” level that kicks off the Laravel Application.
• Controllers: Found in “app/Http/Controllers” (e.g., AuthController, LeadController, ReservationController, PropertyController) to handle incoming requests.
• Middleware: In “app/Http/Middleware” (e.g., Authenticate, VerifyCsrfToken, RoleMiddleware) for processing authentication, authorization, and request conditioning.
• Models: Under “app/Models” (Lead, LeadStatusLog, Property, Reservation, User) representing the business entities.
• Database & Migrations: Managed via “database/migrations” and “database/seeders” to define and initialize the database structure.
• Authentication: Utilizes Laravel Sanctum for token-based user authentication.
• Routing: Routes defined in “routes/api.php”, “routes/web.php”, etc., to map endpoints to controllers.
• Testing: Unit and feature tests under “tests” ensure API behavior and business logic.
Relationships & Data Flow
• Clients (such as Postman, mobile apps, or other frontend interfaces) make HTTP requests.
• Requests hit the entry point in “public/index.php” and flow through the Laravel HTTP kernel, passing various middleware (authentication, role check, CSRF protection, etc.).
• Depending on the endpoint, a controller (for example, LeadController for lead-related actions) is invoked.
• Controllers interact with Models, which reflect the database’s state (MySQL) and invoke business logic.
• The responses are then sent back to the client.
• Alongside, authentication endpoints (register and login) issue tokens to secure further requests.
Architectural Patterns and Design Principles
• MVC Pattern: Controllers handle incoming requests, Models represent data, and views are used minimally (mostly for API documentation provided in views and via Postman URL).
• RESTful API Design: Each resource (leads, reservations, properties) follows distinct CRUD endpoints. Emphasize separation of concerns.
• Middleware and Service Providers: Separate cross-cutting concerns such as authentication and logging.
• Environment Based Configuration: Settings are controlled with environment files (.env) and override defaults via config files.
Detail the Technologies, Frameworks, and Libraries
• Language and Framework: Laravel 10 with PHP (version 8.2+).
• Database: MySQL (configured via “config/database.php” and migrations).
• Authentication: Laravel Sanctum for API token handling.
• Tools: Composer for dependency management, PHPUnit for testing, and Postman collection for API testing.
• Frontend Assets: Although minimal, resources such as “resources/js/app.js” and “resources/css/app.css” exist.
• Clear Labels: Each component—API Gateway, Controllers, Middleware, Models, Database—should be clearly labeled.
• From the Client to the API Gateway.
• From the API Gateway through Middleware to Controllers.
• From Controllers to Models and then to the Database, as well as back.
• Token-based requests through third-party authentication.
• Web entry points (e.g., circle for index.php).
• Controllers and Middleware (rectangles with rounded corners).
Capturing Essential Architectural Elements
• Provide detail without overcomplicating: Ensure every component that processes or transforms data in the system is represented.
• Role separation (Admin vs. Sales Agent) where applicable, especially in the Middleware and Controller interactions.
• Dependency paths: For example, how authentication endpoints give back tokens used in header validations by RoleMiddleware, which then gate access to controllers.
• Configuration and integration points (e.g., config files, environment variables, and external dependencies such as the MySQL database).