Overview
Flux CRM follows a standard Laravel application structure with additional features such as scheduled tasks (commands), reusable traits, and a hybrid frontend setup that uses both Blade templates and Vue.js components as part of an ongoing migration.
Folder Structure
/project-root
│
├── /app
│ ├── /Console
│ │ └── Commands
│ ├── /Http
│ │ ├── Controllers
│ │ ├── Middleware
│ │ ├── Resources
│ ├── /Models
│ ├── /Jobs
│ ├── /Services
│ ├── /Traits
│ ├── /Imports
│ ├── /Exports
│ ├── /Rules
│ └── /Providers
│
├── /config
│
├── /database
│ ├── /factories
│ ├── /migrations
│ └── /seeders
│
├── /public
│ ├── /build
│ └── /assets
│
├── /resources
│ ├── /fonts
│ ├ ── /js
│ ├── /json
│ ├── /lang
│ ├── /css
│ ├── /scss
│ ├── /views
│ └── /vue
│
├── /routes
│ ├── api.php
│ └── web.php
│
├── /tests
│
├── /vendor
│
└── /node_modules
Key Directories and Files
/app
The app folder contains the core business logic of the application, including controllers, models, middleware, and services.
- Controllers: Located in
app/Http/Controllers, controllers handle incoming requests and return appropriate responses. - Models: Found in
app/Models, models represent various entities in the system such asCustomer,Product, orEmployeeand interact with the database. - Services: The
app/Servicesdirectory contains classes that encapsulate complex business logic or external service integrations. - Traits:
app/Traitscontains reusable PHP traits that provide shared functionality across various models and controllers. - Console Commands: Custom Laravel commands for scheduled tasks are defined in
app/Console/Commands.
/config
The config folder contains configuration files for the application. These files define important settings such as database connections, mail drivers, and other services.
/database
- Migrations: Define the structure of the database tables and handle schema changes.
- Seeders: Used to populate the database with initial or test data.
- Factories: Define model templates for generating test data.
/public
The public folder contains static assets, including the entire build of the application, as well as resources like images and styles. It is also the directory served by the web server in a production environment.
/resources
This folder contains the frontend files:
- JavaScript:
resources/jsholds Vue.js components and the JavaScript logic for the frontend. - Blade Views: Stored in
resources/views, these are Laravel’s Blade templates. However, the system is migrating these to Vue.js components. - Sass: All SCSS files for styling are stored in
resources/scss. - Language Files: This folder also holds localization files (
resources/lang) for multi-language support in the Laravel backend. Separate Vue.js$i18nlanguage files are maintained within the JavaScript resources.
/routes
web.php: Contains routes for web-based requests, handling frontend routes via Laravel and Vue.js.api.php: Contains routes that handle API calls, including mostPOST,DELETE, and someGETrequests that interact with the backend without direct user interface involvement.
/tests
Currently, no tests have been implemented for the Flux CRM system. However, unit tests and feature tests may be added in a future update to verify the functionality of models, controllers, and services.
Code Flow
- Routing: Requests are routed via
web.phpfor frontend interactions orapi.phpfor backend API calls. - Controller: Once routed, the request is processed by a controller in
app/Http/Controllers. - Model/Database Interaction: Controllers may interact with models in
app/Modelsto query or update the database. - View Rendering: The response can either be a Blade view (from
resources/views) or a Vue.js component, depending on the setup.
Frontend Structure
- Blade to Vue.js Migration: The frontend structure is transitioning from Laravel Blade templates to a fully component-based Vue.js setup. Currently, the frontend is a mix of both technologies, with Vue.js handling most dynamic content.
- Vue.js Router: Frontend routes are managed through Vue.js components, but initially routed via Laravel’s
web.php. - SCSS: Styles are written in Sass and compiled from
.scssfiles in theresources/scssfolder.
Scheduled Tasks
Custom scheduled tasks are defined in app/Console/Commands and are run via Laravel's scheduling feature (schedule:run). These tasks automate repetitive processes such as reporting, data synchronization, or sending notifications.
Traits
Reusable traits are defined in app/Traits and are used across multiple models and controllers to avoid code duplication. These might include shared functionality for logging, data validation, or access control.