How sebastiandeppisch/heinerenergie-sammelbestellung works
Main Components
• Backend (Laravel):
• Controllers: Found under app/Http/Controllers (e.g., AdviceController, OrderController, etc.) which handle HTTP requests.
• Models: Under app/Models (Advice, Order, BulkOrder, Product, etc.) which represent your domain objects and interact with the database.
• Business Logic: Services like app/Actions (FetchCoordinateByAddress, FetchCoordinateByFreeText); jobs, listeners, and events (e.g., SendNewAdviceInfoToAdvisors, AfterAdviceIsCreated) implement domain logic and asynchronous tasks.
• Middleware and Requests: Under app/Http/Middleware and app/Http/Requests, which validate and secure requests.
• Console Commands: Located in app/Console/Commands, for tasks such as data import and installation routines.
• Database: Migrations, factories, and seeders that define and populate your database schema.
• Configuration & Service Providers: Under config/ and app/Providers, setting up services, authentication, broadcasting, etc.
• Frontend:
• Vue Components: Under resources/js/components and views (e.g., OrderForm.vue, Advices.vue, etc.) that build the user interface.
• Assets and Styles: CSS/SCSS files located in resources/css, resources/sass and public/css.
• JavaScript Setup: Vue router (resources/js/router.ts), store (resources/js/store.ts), and typescript definitions, which coordinate the client-side architecture.
• Infrastructure & Deployment:
• Build Tools: Vite (vite.config.js) and package management (package.json, package-lock.json).
• Environment Configuration: .env.example and config files for database, mail, etc.
• Version control and CI: GitHub workflows in .github/workflows and other CI configurations.
• Testing: Unit and feature tests under tests/ directory.
Relationships and Data Flow
• A web client (browser) loads the frontend Vue components and possibly Single Page Application (SPA) views.
• User requests are routed via Laravel’s routing files (routes/web.php, routes/api.php) to the appropriate controllers.
• Controllers receive input, validate it (using app/Http/Requests), and then invoke business logic. This might include calling Actions under app/Actions or dispatching Jobs (asynchronous tasks) or firing Events.
• The Models interact with the database (configured via migrations and defined in app/Models). The database represents the persistent state.
• Additional flows may include the sending of emails (app/Mail) and notifications (app/Notifications) triggered by events.
Architectural Patterns
• MVC Pattern: The project clearly follows Model-View-Controller architecture – the controllers and HTTP middleware manage the application’s input/output, while models encapsulate domain data.
• Event-Driven Design: Usage of events and listeners (found in app/Events and app/Listeners) shows asynchronous handling of tasks like sending notifications or recalculating coordinates.
• Separation of Concerns: Distinct directories separate the concerns of business logic, presentation (Vue, blade templates), infrastructure, and configuration.
Incorporate Technologies and Libraries
• Laravel Framework (Backend)
• Vue.js (Frontend) plus supporting libraries (e.g., router, state management)
• Vite as the build tool for frontend assets
• Database using Laravel migrations and Eloquent ORM
• Automated testing with PHPUnit and Pest
• GitHub Actions for continuous integration/deployment