Deprixa Plus — Technical Architecture · Request Data Flow
Inertia.js Page Request (Authenticated Users)
- Browser sends an HTTP GET to https://app.yourdomain.com/shipments
- Nginx routes to PHP-FPM socket
- HandleInertiaRequests middleware runs, shares global props (auth user, flash messages, permissions, settings) with the React page
- ShipmentController@index queries the database with Eloquent, applies permission scopes, paginates results
- Controller returns Inertia::render('Shipments/Index', ['shipments' => ...])
- For full page loads: Laravel returns a full HTML page with the React app bootstrapped inside the Blade template
- For Inertia SPA navigations: Laravel returns a JSON response with X-Inertia header — React swaps the page component without a full reload
API Request Flow (External Integrations)
- Client sends POST to /api/tokens with email, password, device_name
- Laravel validates credentials, creates a Sanctum personal access token, returns it in the response
- Client includes Authorization: Bearer {token} header on subsequent requests
- Sanctum middleware authenticates the token, loads the user with their Spatie roles and permissions
- API controller processes the request and returns JSON
Background Job Flow (Notifications, Exports)
- User triggers an action (e.g., mark shipment delivered)
- Controller calls a Service class method
- Service dispatches a queued Job (e.g., SendDeliveryNotification::dispatch($shipment))
- Job is serialized and pushed to the Redis queue
- Queue worker (running as a Supervisord process) picks up the job and executes it asynchronously
- On failure, the job is retried up to 3 times with exponential backoff