How fleetbase/core-api works
Fleetbase Core API is the Laravel-based API framework and resource layer for Fleetbase’s supply-chain operating system. Its user-facing workflow routes API requests to controllers, which operate on domain models and return resources; the package also supplies identity, organization access, files and chat, reporting and scheduling, and integration services. The README documents resource transformation across HTTP, webhook, and broadcast output, plus optional authenticated SocketCluster channels. The sampled evidence supports the routing, OAuth, backup, webhook, and socket links shown; other branches are capability-level components, so their internal calls are not inferred.
Main entry points: routes.php API routes · Controller.php API controllers · ResourceTransformerRegistry.php Resource transformers · SocketAuthController.php Socket authentication
Components 24
API framework
- API routes
src/routes.php - API controllers
src/Http/Controllers/Controller.php - Controller behavior
src/Traits/HasApiControllerBehavior.php - API resources
src/Http/Resources/FleetbaseResource.php - Resource transformers
src/Support/ResourceTransformerRegistry.php - Domain models
src/Models/Model.php - Framework expansions
src/Expansions/Arr.php
Identity and access
- Authentication and authorization
src/Support/Auth.php - Users and organizations
src/Models/User.php - Company membership
src/Models/Company.php - OAuth login and linking
src/Services/OAuth/OAuthFlowService.php
Product capabilities
- File management
src/Http/Controllers/Api/v1/FileController.php - Chat and comments
src/Http/Controllers/Api/v1/ChatChannelController.php - Reporting
src/Support/Reporting/ReportQueryConverter.php - Scheduling
src/Services/Scheduling/ScheduleService.php
Integrations and realtime
- Webhook delivery
src/Webhook/WebhookCall.php - Lifecycle webhook listener
src/Listeners/SendResourceLifecycleWebhook.php - Socket authentication
src/Http/Controllers/SocketAuthController.php - Channel authorization
src/Support/SocketCluster/ChannelAuthorizer.php
Platform services
- Database backup service
src/Services/DatabaseBackup/DatabaseBackupService.php - Backup command
src/Console/Commands/BackupDatabase.php - Backup job
src/Jobs/RunDatabaseBackup.php
Other components
- API client
- SocketCluster server
Connections 23
- API client → API routes: sends requests
src/routes.php - API routes → API controllers: routes requests
src/routes.php - API controllers → Controller behavior: uses behavior
src/Traits/HasApiControllerBehavior.php - API controllers → Domain models: operates on
- API controllers → API resources: returns resources
- API resources → Resource transformers: applies transforms
- Resource transformers → Webhook delivery: transforms payloads
- Resource transformers → SocketCluster server: transforms broadcasts
- Domain models → Framework expansions: extends framework
- Authentication and authorization → Users and organizations: authenticates users
src/Support/Auth.php - Users and organizations → Company membership: has memberships
src/Models/User.php - API routes → OAuth login and linking: routes OAuth
src/routes.php - OAuth login and linking → Authentication and authorization: uses auth support
src/Services/OAuth/OAuthFlowService.php - API routes → File management: routes file APIs
src/routes.php - API routes → Chat and comments: routes chat APIs
src/routes.php - API controllers → Reporting: supports reporting
- API controllers → Scheduling: supports scheduling
- Lifecycle webhook listener → Webhook delivery: dispatches webhooks
src/Listeners/SendResourceLifecycleWebhook.php - API routes → Socket authentication: routes socket auth
src/routes.php - Socket authentication → Channel authorization: authorizes channels
src/Http/Controllers/SocketAuthController.php - SocketCluster server → Socket authentication: requests authorization
- Backup command → Database backup service: runs backups
src/Console/Commands/BackupDatabase.php - Backup job → Database backup service: runs backups
src/Jobs/RunDatabaseBackup.php