### Run Docker Install Script
Source: https://fleetbase.io/docs/platform/quickstart/running-locally
Execute the setup wizard script to automatically handle configuration, start the Docker stack, and run the deploy script.
```bash
git clone https://github.com/fleetbase/fleetbase.git
cd fleetbase
./scripts/docker-install.sh
```
--------------------------------
### Install from Anywhere with Path
Source: https://fleetbase.io/docs/cli/extensions/install
Example of installing an extension from any directory by specifying the Fleetbase instance path.
```bash
flb install fleetbase/storefront --path /path/to/fleetbase
```
--------------------------------
### Install from Fleetbase Directory
Source: https://fleetbase.io/docs/cli/extensions/install
Example of installing an extension when your current directory is the Fleetbase instance's root.
```bash
cd /path/to/fleetbase
flb install fleetbase/storefront
```
--------------------------------
### Verify Installation with a Spinner Component
Source: https://fleetbase.io/docs/ui/getting-started/installation
After installation and starting the console, verify the setup by rendering a simple component like `` in a template.
```handlebars
Loadingβ¦
```
--------------------------------
### Extension Lifecycle Hooks: setupExtension and onEngineLoaded
Source: https://fleetbase.io/docs/extension-development/universe/extension-manager
This example demonstrates the basic structure of an extension exporting lifecycle hooks. `setupExtension` is for synchronous setup before engines load, while `onEngineLoaded` is for setup after your own engine has loaded.
```javascript
export default {
setupExtension(app, universe) {
// synchronous setup β registries, menus, widgets
},
onEngineLoaded(engine, universe, app) {
// engine.lookup('service:my-service'), etc.
},
};
```
--------------------------------
### Run Fleetbase Installation Wizard
Source: https://fleetbase.io/docs/cli/installation/overview
Execute the interactive wizard to install Fleetbase. This command initiates a guided setup process that configures your environment.
```bash
flb install-fleetbase
```
--------------------------------
### Install using Extension ID
Source: https://fleetbase.io/docs/cli/extensions/install
Example of installing an extension using its unique extension ID, specifying the Fleetbase instance path.
```bash
flb install ext_a1b2c3d4 --path /path/to/fleetbase
```
--------------------------------
### Enable and Install FleetOps with Immediate Install
Source: https://fleetbase.io/docs/platform/quickstart/development-setup
Use the `--install` flag with the `enable` command to have the linker run the installation commands immediately after updating manifests.
```bash
flb-package-linker enable fleetops --shared ember-core ember-ui fleetops-data --install
```
--------------------------------
### Standard Login Example
Source: https://fleetbase.io/docs/cli/account/login
A basic example of logging in with provided username, password, and email.
```bash
flb login -u jane -p secret -e jane@example.com
```
--------------------------------
### Enable and Install Multiple Extensions
Source: https://fleetbase.io/docs/platform/quickstart/development-setup
Enable and install multiple extensions simultaneously. The `install` command consolidates backend Composer package updates.
```bash
flb-package-linker enable fleetops pallet --shared ember-core ember-ui fleetops-data
flb-package-linker install fleetops pallet
```
```bash
cd api && composer update fleetbase/fleetops-api fleetbase/pallet-api --with-dependencies
```
--------------------------------
### Real-World Examples
Source: https://fleetbase.io/docs/ui/services/sidebar
Practical examples demonstrating how to use the Sidebar Service in common scenarios.
```APIDOC
## Real-World Examples
### Hiding sidebar for full-screen view
```javascript
// Hide the sidebar when entering a full-screen workflow
@action enterFullscreen() {
this.sidebar.hide();
}
@action exitFullscreen() {
this.sidebar.show();
}
```
### Disabling sidebar during onboarding
```javascript
// Disable the sidebar entirely (e.g. during onboarding)
@action startOnboarding() {
this.sidebar.disable();
}
@action finishOnboarding() {
this.sidebar.enable(); // restores the previous state
}
```
### Minimizing sidebar for focus mode
```javascript
@action focusMode() {
this.sidebar.minimize();
}
```
```
--------------------------------
### Install Nginx
Source: https://fleetbase.io/docs/platform/quickstart/deploy-in-cloud
Install Nginx on your server using apt-get. This is a prerequisite for setting up the reverse proxy.
```bash
sudo apt-get update && sudo apt-get install -y nginx
```
--------------------------------
### Start Docker Containers
Source: https://fleetbase.io/docs/cli/installation/overview
The installation wizard uses this command to start the Fleetbase Docker containers in detached mode.
```bash
docker compose up -d
```
--------------------------------
### Default Formatted Output Example
Source: https://fleetbase.io/docs/cli/extensions/search
Shows the default, human-readable output when searching for extensions. This format includes details like name, version, price, install count, category, slug, publisher, and subtitle.
```bash
flb search storefront
```
```text
π Searching Fleetbase Extensions...
Found 1 extension:
Storefront v1.2.0 Free β 142 [Commerce]
fleetbase/storefront by Fleetbase
Headless commerce and marketplace platform for Fleetbase.
Install: flb install fleetbase/storefront or flb install ext_xxx
βββββββββββββββββββββββββββββββββββββββββββββ
Use flb install fleetbase/ or flb install to install an extension.
Use flb search --json for machine-readable output.
```
--------------------------------
### Install Flask for Python
Source: https://fleetbase.io/docs/platform/recipes/connect-your-first-webhook
Install the Flask framework to handle incoming webhook requests.
```bash
pip install flask
```
--------------------------------
### Example: Look Up a Specific Package
Source: https://fleetbase.io/docs/cli/extensions/search
A straightforward example of searching for a single, known extension by its name or slug.
```bash
flb search storefront
```
--------------------------------
### Example cURL Request with API Key
Source: https://fleetbase.io/docs/platform/developer-console/api-keys
This example demonstrates how to make a GET request to the orders endpoint using cURL, including the Authorization header with a live API key.
```bash
curl -X GET "https://api.fleetbase.io/v1/orders" \
-H "Authorization: Bearer flb_live_your_public_key_here" \
-H "Content-Type: application/json"
```
--------------------------------
### JSON Output Example
Source: https://fleetbase.io/docs/cli/extensions/search
Demonstrates how to get raw JSON output for scripting purposes. This is useful for piping the results into tools like `jq`.
```bash
flb search storefront --json
```
```bash
flb search --json | jq '.[].slug'
```
--------------------------------
### Install Express for Node.js
Source: https://fleetbase.io/docs/platform/recipes/connect-your-first-webhook
Install the Express.js framework to handle incoming webhook requests.
```bash
npm install express
```
--------------------------------
### Setup Extension with Registry Service
Source: https://fleetbase.io/docs/extension-development/universe/registry-service
This snippet shows how to access the registry service within an extension's setup function.
```javascript
import { ExtensionComponent } from '@fleetbase/ember-core/contracts';
export default {
setupExtension(app, universe) {
const registryService = universe.getService('registry');
// β¦
},
};
```
--------------------------------
### Clone and Install Navigator App
Source: https://fleetbase.io/docs/fleet-ops/navigator-app/quickstart
Clone the Navigator App repository, install dependencies, and prepare for configuration.
```bash
git clone git@github.com:fleetbase/navigator-app.git
cd navigator-app
yarn
yarn pod:install
touch .env
```
--------------------------------
### Overlay Real-World Example
Source: https://fleetbase.io/docs/ui/layout/overlay
An example of a right-docked detail overlay with resizable and minimizable options.
```APIDOC
## `` Real-World Examples
```
{{!-- Right-docked detail overlay --}}
{{this.selectedOrder.public_id}}
{{!-- ... --}}
```
```
--------------------------------
### Install Extensions via CLI
Source: https://fleetbase.io/docs/platform/extensions/browsing-and-installing
Install extensions using the `flb install` command, specifying the extension identifier. You can also specify a target Fleetbase instance directory.
```bash
# Install an extension by name
flb install fleetbase/fleetops
# Install to a specific Fleetbase instance directory
flb install fleetbase/fleetops --path /opt/fleetbase
```
--------------------------------
### Install Frontend Addon Locally
Source: https://fleetbase.io/docs/extension-development/getting-started/quickstart
Before linking, build the frontend addon by installing its dependencies locally within the extension's package directory.
```bash
cd packages/my-extension
pnpm install
```
--------------------------------
### Install Client Library via npm
Source: https://fleetbase.io/docs/platform/recipes/set-up-real-time-tracking
Install the Fleetbase client library using npm for Node.js projects.
```bash
npm install socketcluster-client
```
--------------------------------
### Quick Reference for Fleetbase CLI Commands
Source: https://fleetbase.io/docs/cli
Common commands for installing Fleetbase, searching and installing extensions, scaffolding new extensions, and publishing them.
```bash
# Install Fleetbase on your machine
flb install-fleetbase
```
```bash
# Find an extension on the registry
flb search
```
```bash
# Install an extension into your instance
flb install fleetbase/storefront
```
```bash
# Create a new extension
flb scaffold
```
```bash
# Publish your extension to the registry
flb bundle --upload
flb publish
```
--------------------------------
### Install Backend Dependencies and Deploy
Source: https://fleetbase.io/docs/extension-development/getting-started/quickstart
After configuring `composer.json`, install backend dependencies and deploy within the running Docker container.
```bash
docker compose exec application composer install
docker compose exec application bash -c "./deploy.sh"
```
--------------------------------
### Real-World ActivityLog Example
Source: https://fleetbase.io/docs/ui/display/activity-log
An example of integrating ActivityLog within a content panel, configuring density, attribute display, and a callback for user clicks.
```handlebars
{{!-- Inside an order detail overlay --}}
```
--------------------------------
### Complete addon/extension.js Example
Source: https://fleetbase.io/docs/extension-development/universe
A comprehensive example demonstrating how to set up an extension by integrating multiple Fleetbase services, including menu, registry, widget, and hook services.
```javascript
// addon/extension.js
import { MenuItem, Widget, ExtensionComponent, Hook } from '@fleetbase/ember-core/contracts';
export default {
setupExtension(app, universe) {
const menuService = universe.getService('menu');
const registryService = universe.getService('registry');
const widgetService = universe.getService('widget');
const hookService = universe.getService('hook');
// 1. Top-level header item
menuService.registerHeaderMenuItem('My Extension', 'console.my-extension', {
icon: 'puzzle-piece',
description: 'My custom logistics feature.',
});
// 2. Settings item
menuService.registerSettingsMenuItem(
new MenuItem({
title: 'My Extension',
slug: 'my-extension',
icon: 'gear',
component: new ExtensionComponent('@my-org/my-extension-engine', 'settings'),
})
);
// 3. Inject a component into another extension's slot
registryService.registerRenderableComponent(
'fleet-ops:component:order:details',
new ExtensionComponent('@my-org/my-extension-engine', 'my-order-tab')
);
// 4. Register a dashboard widget
widgetService.registerWidgets('dashboard', [
new Widget({
id: 'my-extension-stats',
name: 'My Stats',
icon: 'chart-line',
component: new ExtensionComponent('@my-org/my-extension-engine', 'widget/my-stats'),
grid_options: { w: 6, h: 6, minW: 4, minH: 4 },
}),
]);
// 5. Hook into the console boot
hookService.registerHook(
new Hook('console:after-model', (session, router) => {
// do something after the user is authenticated
})
);
},
};
```
--------------------------------
### Registering Extension Components
Source: https://fleetbase.io/docs/extension-development/architecture/extension-registration
Example of using `setupExtension` to register menu items, widgets, registries, and hooks using Fleetbase's `universe` service.
```javascript
import { MenuItem, Widget, ExtensionComponent, Hook } from '@fleetbase/ember-core/contracts';
export default {
setupExtension(app, universe) {
const menuService = universe.getService('menu');
const widgetService = universe.getService('widget');
const registryService = universe.getService('registry');
const hookService = universe.getService('hook');
menuService.registerHeaderMenuItem('My Extension', 'console.my-extension', {
icon: 'puzzle-piece',
description: 'My custom logistics feature.',
});
widgetService.registerWidgets('dashboard', [
new Widget({
id: 'my-stats',
name: 'My Stats',
icon: 'chart-line',
component: new ExtensionComponent('@my-org/my-extension-engine', 'widget/my-stats'),
grid_options: { w: 6, h: 6, minW: 4, minH: 4 },
}),
]);
registryService.createRegistries(['my-extension:sidebar']);
hookService.registerHook(
new Hook('console:after-model', (session, router) => {
// β¦
})
);
},
};
```
--------------------------------
### Order Next Activity Response
Source: https://fleetbase.io/docs/api/fleetbase/orders
Example response for the 'Get Order Next Activity' endpoint, showing possible workflow steps like 'started' or 'completed'.
```json
[
{
"code": "started",
"status": "Order started",
"details": "The assigned driver has started the order.",
"sequence": 2,
"_resolved_status": "Order started",
"_resolved_details": "The assigned driver has started the order."
},
{
"code": "completed",
"status": "Order completed",
"details": "The order has been completed.",
"sequence": 3,
"require_pod": true,
"pod_method": "signature",
"_resolved_status": "Order completed",
"_resolved_details": "The order has been completed."
}
]
```
--------------------------------
### Complete addon/extension.js Example
Source: https://fleetbase.io/docs/extension-development/universe/overview
This example shows how to set up an extension by registering menu items, rendering components, adding widgets, and hooking into application events. It requires importing necessary contracts from '@fleetbase/ember-core/contracts'.
```javascript
// addon/extension.js
import { MenuItem, Widget, ExtensionComponent, Hook } from '@fleetbase/ember-core/contracts';
export default {
setupExtension(app, universe) {
const menuService = universe.getService('menu');
const registryService = universe.getService('registry');
const widgetService = universe.getService('widget');
const hookService = universe.getService('hook');
// 1. Top-level header item
menuService.registerHeaderMenuItem('My Extension', 'console.my-extension', {
icon: 'puzzle-piece',
description: 'My custom logistics feature.',
});
// 2. Settings item
menuService.registerSettingsMenuItem(
new MenuItem({
title: 'My Extension',
slug: 'my-extension',
icon: 'gear',
component: new ExtensionComponent('@my-org/my-extension-engine', 'settings'),
})
);
// 3. Inject a component into another extension's slot
registryService.registerRenderableComponent(
'fleet-ops:component:order:details',
new ExtensionComponent('@my-org/my-extension-engine', 'my-order-tab')
);
// 4. Register a dashboard widget
widgetService.registerWidgets('dashboard', [
new Widget({
id: 'my-extension-stats',
name: 'My Stats',
icon: 'chart-line',
component: new ExtensionComponent('@my-org/my-extension-engine', 'widget/my-stats'),
grid_options: { w: 6, h: 6, minW: 4, minH: 4 },
}),
]);
// 5. Hook into the console boot
hookService.registerHook(
new Hook('console:after-model', (session, router) => {
// do something after the user is authenticated
})
);
},
};
```
--------------------------------
### Create a bundle
Source: https://fleetbase.io/docs/cli/extension-development/bundle
Navigate to your extension's root directory and run `flb bundle` to create a `.tar.gz` archive. The output will indicate the bundle creation and its location.
```bash
cd /path/to/your-extension
flb bundle
```
```text
Creating bundle vehicle-inspections-v1.2.0-bundle.tar.gz...
Bundle created at /path/to/your-extension/vehicle-inspections-v1.2.0-bundle.tar.gz
```
--------------------------------
### Get Stripe Setup Intent
Source: https://fleetbase.io/docs/api/storefront/customer
Retrieves a Stripe Setup Intent for the customer, used for saving payment methods.
```APIDOC
## POST /v1/customers/stripe-setup-intent
### Description
Retrieves a Stripe Setup Intent for the customer, used for saving payment methods.
### Method
POST
### Endpoint
/v1/customers/stripe-setup-intent
### Response
#### Success Response (200)
- **client_secret** (string) - The client secret for the Stripe Setup Intent.
```
--------------------------------
### Setup Extension with Universe Service
Source: https://fleetbase.io/docs/extension-development/universe
Initialize your extension by accessing the Universe Service and its sub-services within the setupExtension hook. This is where you register your extension's contributions.
```javascript
// addon/extension.js
import { MenuItem, ExtensionComponent } from '@fleetbase/ember-core/contracts';
export default {
setupExtension(app, universe) {
const menuService = universe.getService('menu');
const registryService = universe.getService('registry');
const widgetService = universe.getService('widget');
const hookService = universe.getService('hook');
// β¦ register your contributions
},
};
```
--------------------------------
### Query Parts using cURL
Source: https://fleetbase.io/docs/api/fleetbase/parts
Example of querying parts using a GET request to the /v1/parts endpoint. Requires Authorization header.
```curl
curl https://api.fleetbase.io/v1/parts \
-H "Authorization: Bearer flb_live_β¦"
```
--------------------------------
### Get Driver Onboard Settings
Source: https://fleetbase.io/docs/api/fleetbase/onboard
Returns driver onboarding settings for an organization. This is useful for bootstrapping or verifying account context during initial setup.
```APIDOC
## GET /v1/onboard/driver-onboard-settings/:companyId
### Description
Returns driver onboarding settings for an organization.
### Method
GET
### Endpoint
/v1/onboard/driver-onboard-settings/:companyId
### Parameters
#### Path Parameters
- **companyId** (string) - Required - The ID of the company to retrieve settings for.
### Request Example
```
curl https://api.fleetbase.io/v1/onboard/driver-onboard-settings/:companyId \
-H "Authorization: Bearer flb_live_β¦"
```
### Response
#### Success Response (200)
- **settings** (object) - An object containing driver onboarding settings.
- **settings.allow_self_registration** (boolean) - Whether self-registration is allowed.
- **settings.require_phone_verification** (boolean) - Whether phone verification is required.
- **settings.require_document_upload** (boolean) - Whether document upload is required.
- **settings.default_country_code** (string) - The default country code for phone numbers.
#### Response Example
```json
{
"settings": {
"allow_self_registration": true,
"require_phone_verification": true,
"require_document_upload": false,
"default_country_code": "+1"
}
}
```
```
--------------------------------
### Engine Application Route Setup
Source: https://fleetbase.io/docs/extension-development/frontend/routing
The `addon/routes/application.js` file is executed once per engine boot. Use it for engine-local setup like theme classes or polling.
```javascript
// addon/routes/application.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ApplicationRoute extends Route {
@service theme;
@service session;
activate() {
this.theme.setRoutebodyClassNames(['my-extension']);
}
}
```
--------------------------------
### Get Hook Service Instance
Source: https://fleetbase.io/docs/extension-development/universe/hook-service
Retrieve the hook service instance within an extension's setup. This service is a singleton shared across all engines.
```javascript
import { Hook } from '@fleetbase/ember-core/contracts';
export default {
setupExtension(app, universe) {
const hookService = universe.getService('hook');
// β¦
},
};
```
--------------------------------
### Get Stripe Setup Intent
Source: https://fleetbase.io/docs/api/storefront/customer
Create a Stripe SetupIntent for an authenticated customer to manage payment methods. The client secret is used for collecting or updating saved payment details.
```curl
curl -X POST https://api.fleetbase.io/v1/customers/stripe-setup-intent \
-H "Authorization: Bearer flb_live_β¦" \
-H "Content-Type: application/json" \
-d '{}'
```
--------------------------------
### Retrieve a Driver with Custom Fields
Source: https://fleetbase.io/docs/platform/recipes/configure-custom-fields
This example demonstrates how to make a GET request to retrieve a specific driver record. The response will include both standard driver information and any custom fields that have been added.
```APIDOC
## GET /v1/drivers/:id
### Description
Retrieves a specific driver record, including any custom fields configured for drivers.
### Method
GET
### Endpoint
`/v1/drivers/:id`
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the driver.
#### Request Example
```bash
curl -X GET "https://api.fleetbase.io/v1/drivers/DRV-001" \
-H "Authorization: Bearer flb_live_your_public_key_here" \
-H "Content-Type: application/json"
```
### Response
#### Success Response (200)
- **id** (string) - The unique identifier of the driver.
- **public_id** (string) - The public-facing identifier of the driver.
- **name** (string) - The name of the driver.
- **phone** (string) - The phone number of the driver.
- **status** (string) - The current status of the driver.
- **contact_name** (string) - The name of the emergency contact.
- **contact_phone** (string) - The phone number of the emergency contact.
- **relationship** (string) - The relationship of the contact to the driver.
- **licence_number** (string) - The driver's license number.
- **licence_class** (string) - The driver's license class.
- **licence_expiry** (string) - The expiration date of the driver's license.
- **custom_fields** (string[]) - An array of snake_case key names for all custom fields defined on this resource.
- **custom_field_values** (object[]) - An array of objects, where each object contains a `key` and `value` for a custom field.
#### Response Example
```json
{
"id": "driver_01H...",
"public_id": "DRV-001",
"name": "Alex Tan",
"phone": "+6591234567",
"status": "active",
"contact_name": "Sarah Tan",
"contact_phone": "+6598765432",
"relationship": "Spouse",
"licence_number": "S1234567A",
"licence_class": "B",
"licence_expiry": "2028-06-30",
"custom_fields": [
"contact_name",
"contact_phone",
"relationship",
"licence_number",
"licence_class",
"licence_expiry"
],
"custom_field_values": [
{ "key": "contact_name", "value": "Sarah Tan" },
{ "key": "contact_phone", "value": "+6598765432" },
{ "key": "relationship", "value": "Spouse" }
]
}
```
```
--------------------------------
### Example Migration File Structure
Source: https://fleetbase.io/docs/extension-development/backend/migrations
Migrations for an extension should reside in the server/migrations/ directory.
```plaintext
server/
βββ migrations/
βββ 2026_01_15_000000_create_widgets_table.php
```
--------------------------------
### Install Dependencies with PNPM
Source: https://fleetbase.io/docs/contributing/documentation
Install the necessary project dependencies using PNPM. Ensure you have PNPM installed globally.
```bash
pnpm install
```
--------------------------------
### Create Stripe Setup Intent
Source: https://fleetbase.io/docs/api/storefront/checkout
Creates a Stripe SetupIntent for a storefront customer. The response includes Stripe client data for saving a payment method.
```APIDOC
## POST /v1/checkouts/stripe-setup-intent
### Description
Creates a Stripe SetupIntent for a storefront customer. The response includes Stripe client data for saving a payment method.
### Method
POST
### Endpoint
/v1/checkouts/stripe-setup-intent
### Parameters
#### Request Body
- **customer** (string) - Required - The ID of the customer.
- **name** (string) - Optional - Display name for the resource.
- **description** (string) - Optional - Human-readable description of the resource.
- **status** (enum) - Optional - Lifecycle status to apply to the resource. One of `active`, `inactive`.
- **meta** (string) - Optional - Arbitrary metadata stored with the resource.
### Request Example
```json
{
"customer": "{{customer_id}}"
}
```
### Response
#### Success Response (200)
- **client_secret** (string) - The client secret for the Stripe SetupIntent.
- **status** (string) - The status of the SetupIntent.
```
--------------------------------
### Initialize Checkout - POST /checkouts/before
Source: https://fleetbase.io/docs/storefront/orders/checkout
Submit cart, service quote, gateway, and customer details to initialize checkout and obtain a token. Use this for both delivery and pickup orders. Omit `serviceQuote` for pickup orders.
```bash
POST /storefront/v1/checkouts/before
Authorization: Bearer store_your_store_key
Customer-Token: 1|VlKK7lZ...
{
"cart": "cart_abc123",
"gateway": "gateway_stripe_id",
"serviceQuote": "service_quote_id",
"customer": "customer_abc123",
"pickup": false,
"tip": 200,
"deliveryTip": 100
}
```
--------------------------------
### Install Extension via Fleetbase CLI
Source: https://fleetbase.io/docs/platform/extensions
Use the Fleetbase CLI to install extensions directly from the registry. This command installs the FleetOps extension.
```bash
flb install fleetbase/fleetops
```
--------------------------------
### Verify Fleetbase CLI Installation
Source: https://fleetbase.io/docs/cli/getting-started/installation
Verify that the Fleetbase CLI has been installed correctly by checking its version. This command should output the installed version number.
```bash
flb --version
```
--------------------------------
### Basic Kanban Usage
Source: https://fleetbase.io/docs/ui/scheduling/kanban
Demonstrates the fundamental setup of the Kanban component with columns, items, and event handlers for item drops and clicks.
```handlebars
<:card as |item|>
{{item.title}}
{{item.description}}
```
--------------------------------
### Basic Install Command
Source: https://fleetbase.io/docs/cli/extensions/install
Installs a Fleetbase extension into a running self-hosted Fleetbase instance. The CLI automatically handles npm and Composer package installations.
```bash
flb install
```
--------------------------------
### Wait for Engine and Register Service
Source: https://fleetbase.io/docs/ui/registry/overview
Execute setup logic only after a specific engine has loaded. This is useful for integrating services between different engines.
```javascript
universe.whenEngineLoaded('@fleetbase/fleetops-engine', async (fleetopsEngine, universe) => {
const myEngine = await universe.extensionManager.ensureEngineLoaded('@my-org/my-engine');
const routeOptimization = fleetopsEngine.lookup('service:route-optimization');
const myProvider = myEngine.lookup('service:my-provider');
routeOptimization.register('my-provider', myProvider);
});
```
--------------------------------
### Step 1: Initialize Checkout (`/checkouts/before`)
Source: https://fleetbase.io/docs/storefront/orders/checkout
Submit cart details, service quote, gateway, tip, and pickup/delivery preferences to initialize the checkout process. This step returns a token and, if using Stripe, a client secret for payment confirmation.
```APIDOC
## POST /storefront/v1/checkouts/before
### Description
Initializes the checkout process by submitting cart, gateway, service quote, customer, and delivery/pickup details. Returns a token and potentially a payment gateway client secret.
### Method
POST
### Endpoint
/storefront/v1/checkouts/before
### Headers
- **Authorization**: Bearer store_your_store_key
- **Customer-Token**: 1|VlKK7lZ...
### Request Body
- **cart** (string) - Required - The cart's public id.
- **gateway** (string) - Required - The gateway public id selected by the customer.
- **serviceQuote** (string) - Required (omit for pickup orders) - The Service Quote id.
- **customer** (string) - Required - The customer's public id.
- **pickup** (boolean) - Optional - `true` for in-store pickup, defaults to delivery.
- **tip** (integer) - Optional - Driver tip in minor currency units (e.g., `100` = $1.00 USD).
- **deliveryTip** (integer) - Optional - Separate delivery tip when `delivery_tips_enabled`.
- **is_cod** (boolean) - Optional - `true` if the customer is paying cash on delivery.
### Response
#### Success Response (200)
- **token** (string) - The checkout token.
- **clientSecret** (string) - Optional - Payment gateway client secret (e.g., for Stripe).
### Request Example
```json
{
"cart": "cart_abc123",
"gateway": "gateway_stripe_id",
"serviceQuote": "service_quote_id",
"customer": "customer_abc123",
"pickup": false,
"tip": 200,
"deliveryTip": 100
}
```
### Response Example
```json
{
"token": "checkout_token_abc",
"clientSecret": "pi_xxx_secret_yyy"
}
```
```
--------------------------------
### Start an Order
Source: https://fleetbase.io/docs/api/fleetbase/orders
Starts an order and transitions it into active execution. Use this when a driver or dispatcher begins fulfillment. The `skip_dispatch` parameter can be used to start an order even if it has not been dispatched.
```curl
curl -X POST https://api.fleetbase.io/v1/orders/:id/start \
-H "Authorization: Bearer flb_live_β¦" \
-H "Content-Type: application/json" \
-d '{
"skip_dispatch": false
}'
```
--------------------------------
### Install Certbot and Obtain SSL Certificates
Source: https://fleetbase.io/docs/platform/quickstart/deploy-in-cloud
Use Certbot with Let's Encrypt to install free, auto-renewing SSL certificates for your domains. Ensure you have Nginx installed and configured.
```bash
sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx \
-d console.yourdomain.com \
-d api.yourdomain.com \
--non-interactive \
--agree-tos \
-m admin@yourdomain.com
```
--------------------------------
### Production Fleetbase Installation with Specific Host
Source: https://fleetbase.io/docs/cli/installation/overview
Install Fleetbase in a production environment, specifying the host, environment type, and installation directory. You will still be prompted for database, mail, storage, and API choices.
```bash
flb install-fleetbase \
--host fleetbase.mycompany.com \
--environment production \
--directory /opt/fleetbase
```
--------------------------------
### Real-World Example: FleetOps Dashboard Component
Source: https://fleetbase.io/docs/ui/dashboard/service
An example demonstrating how to inject the dashboard service, load initial dashboards in the constructor, and toggle edit mode or add widgets using actions.
```javascript
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class FleetOpsDashboardComponent extends Component {
@service dashboard;
constructor() {
super(...arguments);
this.dashboard.loadDashboards.perform({
defaultDashboardId: 'fleet-ops-overview',
defaultDashboardName: 'Overview',
extension: 'fleet-ops',
});
}
@action toggleEdit() {
this.dashboard.onChangeEdit(!this.dashboard.isEditingDashboard);
}
@action async addWidget() {
this.dashboard.onAddingWidget(true);
}
}
```
--------------------------------
### Console Application Boot Process
Source: https://fleetbase.io/docs/extension-development/getting-started/extension-anatomy
Illustrates the sequence of events when a console application boots and loads extensions, including the roles of ExtensionManager and setupExtension.
```plaintext
Console application boots
βββ ExtensionManager loads each extension's addon/extension.js
β βββ setupExtension(app, universe) runs
β βββ menu service registers your header item, settings panels, etc.
β βββ widget service registers your dashboard widgets
β βββ registry service creates registries / injects components
β
βββ On first navigation into your extension:
βββ Ember loads addon/engine.js
βββ routes.js wires your route map
βββ onEngineLoaded(engineInstance, universe, app) fires (if exported)
```
--------------------------------
### Real-World Example: Registering FleetOps Models
Source: https://fleetbase.io/docs/ui/services/template-builder
A comprehensive example registering core FleetOps models including Order, Driver, Vehicle, Place, and Service Rate. This makes them available in the template builder's query picker.
```javascript
// addon/instance-initializers/register-template-resources.js
export function initialize(appInstance) {
const templateBuilder = appInstance.lookup('service:template-builder');
if (!templateBuilder) return;
templateBuilder.registerResourceTypes([
{ label: 'Order', value: 'Fleetbase\FleetOps\Models\Order', icon: 'route' },
{ label: 'Driver', value: 'Fleetbase\FleetOps\Models\Driver', icon: 'id-card' },
{ label: 'Vehicle', value: 'Fleetbase\FleetOps\Models\Vehicle', icon: 'truck' },
{ label: 'Place', value: 'Fleetbase\FleetOps\Models\Place', icon: 'location-dot' },
{ label: 'Service Rate', value: 'Fleetbase\FleetOps\Models\ServiceRate', icon: 'dollar-sign' },
]);
}
export default { initialize };
```
--------------------------------
### Basic `flb search` Usage
Source: https://fleetbase.io/docs/cli/extensions/search
Demonstrates basic commands to list all extensions or filter by a query, category, or price.
```bash
flb search # List everything
flb search storefront # Filter by query
flb search --category logistics # Filter by category
flb search --free # Show only free extensions
```
--------------------------------
### Addon Structure Example
Source: https://fleetbase.io/docs/storefront/catalog/variants-and-addons
Shows the structure of a product with an addon category for toppings, including max selectable and required status.
```text
Product "Burger"
βββ Addon Category "Toppings" (max_selectable: 3, is_required: false)
βββ Addon "Extra Cheese" β +$1.00
βββ Addon "Bacon" β +$1.50
βββ Addon "Avocado" β +$2.00
βββ Addon "JalapeΓ±os" β +$0.50
```
--------------------------------
### Install Docker on Linux
Source: https://fleetbase.io/docs/platform/quickstart/deploy-in-cloud
Installs Docker on your Linux server. Ensure you are logged in as a user with sudo privileges.
```bash
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
newgrp docker
```
--------------------------------
### Install Frontend Dependencies in Console
Source: https://fleetbase.io/docs/extension-development/getting-started/quickstart
After linking the frontend addon, install dependencies within the `fleetbase/console` directory.
```bash
cd fleetbase/console
pnpm install
```
--------------------------------
### Real-World InputGroup Examples
Source: https://fleetbase.io/docs/ui/inputs/input-group
Collection of practical examples showcasing different InputGroup configurations, including simple text fields, number inputs, and integration with Select and custom widgets.
```handlebars
{{!-- Simple text field --}}
```
```handlebars
{{!-- Number field --}}
```
```handlebars
{{!-- Wrapping a Select --}}
```
```handlebars
{{!-- Wrapping a custom widget --}}
```