fleetbase/storefront-api

Headless Commerce & Marketplace Extension for Fleetbase

Maintainers

Package info

github.com/fleetbase/storefront

pkg:composer/fleetbase/storefront-api

Statistics

Installs: 24 003

Dependents: 0

Suggesters: 0

Stars: 6

Open Issues: 2


README

Fleetbase Storefront

Logistics-first headless commerce and marketplace infrastructure for Fleetbase.

Documentation | GitHub | Platform Overview | Fleetbase

License: AGPL-3.0-or-later PHP ^8.0 Node >=18 Ember Engine

Fleetbase Storefront dashboard

Overview

Storefront is the commerce extension for Fleetbase. It combines a Laravel API package with an Ember engine for the Fleetbase Console, giving operators the tools to manage stores, products, carts, checkout, customers, marketplace networks, and fulfillment workflows from one logistics-native system.

Unlike a generic e-commerce plugin, Storefront is built around the handoff from purchase to delivery. A checkout can create Fleet-Ops orders, attach storefront order metadata, expose customer and commerce details in the Fleetbase Console, and keep operators close to the real delivery lifecycle.

Read the official guide at fleetbase.io/docs/storefront.

Features

  • Store and marketplace management: run a single store or organize many stores into Storefront networks.
  • Product catalog: manage products, categories, variants, variant options, addons, addon categories, images, pricing, tags, and availability hours.
  • Locations and mobile commerce: configure store locations, service areas, food trucks, Fleet-Ops vehicle links, and catalogs assigned to mobile stores.
  • Carts and checkout: support persistent carts, line items, variants, addons, scheduled items, service quotes, checkout initialization, and order capture.
  • Payments: configure Stripe, QPay, and cash-on-delivery flows through Storefront gateways.
  • Customers: support customer registration, login, SMS verification, social login hooks, saved customer metadata, device registration, order history, and account closure flows.
  • Orders and fulfillment: manage Storefront orders in the console, advance order activity, assign/unassign drivers, mark preparation states, complete pickups, and inspect commerce details alongside route and tracking data.
  • Reviews and votes: expose API resources for customer reviews and voting.
  • Promotions and notifications: manage notification channels and send broadcast or transactional push notifications through APNs, FCM, and related Storefront notification classes.
  • Dashboard analytics: ship Storefront widgets for revenue, order volume, average order value, active orders, completed orders, customers, cart conversion, cancellation rate, revenue trends, top products, customer insights, order status mix, recent orders, and recent customers.
  • Fleet-Ops integration: register Storefront summaries inside Fleet-Ops order details and add product-as-entity tooling to Fleet-Ops order creation.
  • Internationalization: include translations for multiple locales through the extension translation files.

Architecture

This repository contains both sides of the Storefront extension:

Area Path Purpose
Ember engine addon/, app/, config/, translations/ Fleetbase Console UI, routes, models, components, services, widgets, and translations.
Laravel API server/src/, server/config/, server/migrations/ Storefront API controllers, models, resources, middleware, providers, observers, notifications, jobs, and database migrations.
Tests tests/, server/tests/ Ember integration tests and backend test scaffolding.

The Ember package is published as @fleetbase/storefront-engine. The Laravel package is published as fleetbase/storefront-api.

Console Modules

Storefront registers a Console entry under the storefront route and exposes these primary work areas:

  • Dashboard: Storefront-specific operational and analytics widgets.
  • Products: product catalog, categories, variants, addons, import processing, and product entity creation.
  • Orders: incoming Storefront orders, activity actions, customer details, commerce summary, documents, route/tracking context, and comments.
  • Customers: customer records and order history.
  • Networks: multi-store marketplace networks, store assignment, categories, invitations, and network-level views for stores, customers, and orders.
  • Catalogs: product bundles and catalog categories, including food truck catalog assignment.
  • Food Trucks: Fleet-Ops vehicle-linked mobile stores with service area and zone support.
  • Promotions: push notification campaigns and notification channel workflows.
  • Settings: store profile, API keys, locations, gateways, and notifications.

API Surface

Storefront exposes two API families.

Public Storefront API

The public customer-facing API is mounted under storefront/v1 and protected by Storefront API middleware. It includes:

  • Store lookup, store/network information, locations, gateways, search, tags, and network stores.
  • Categories, products, food trucks, reviews, and customer-facing catalog browsing.
  • Persistent carts with add, update, remove, empty, and delete operations.
  • Service quotes from carts.
  • Checkout initialization, status, capture, Stripe setup intents, Stripe payment intent updates, and QPay capture callbacks.
  • Customer registration, login, SMS code verification, social login endpoints, device registration, saved places, customer orders, phone verification, Stripe customer helpers, and account closure flows.
  • Order pickup completion and receipt generation.

Internal Console API

The protected internal API is mounted under storefront/int/v1. It powers the Fleetbase Console and includes:

  • CRUD resources for orders, customers, stores, store hours, store locations, products, product hours, variants, variant options, addons, addon categories, gateways, notification channels, reviews, votes, food trucks, catalogs, catalog categories, and catalog hours.
  • Order actions for accept, preparing, ready, completed, cancel, and unassign driver.
  • Network actions for adding stores, removing stores, categories, invitations, and network lookup.
  • Analytics endpoints for overview, revenue trends, order status mix, top products, and customer insights.
  • Metrics and operational action endpoints.

Getting Started

Storefront is designed to run inside a Fleetbase installation with fleetbase/core-api and fleetbase/fleetops-api available.

Requirements

  • PHP ^8.0
  • Node.js >=18
  • pnpm
  • Composer
  • Fleetbase Core API
  • Fleetbase FleetOps API

Install Dependencies

pnpm install
composer install

Backend Package

composer require fleetbase/core-api
composer require fleetbase/fleetops-api
composer require fleetbase/storefront-api

Frontend Package

pnpm install @fleetbase/storefront-engine

Development

For the full local Fleetbase workflow, see the Fleetbase Development Setup guide. That guide covers cloning the main repository with submodules, mounting live package source, linking extensions, running the Console dev server, and reloading the API after backend changes.

Use Local Storefront Source in Fleetbase

When developing Storefront inside the Fleetbase monorepo, run the package linker from the repository root so the local packages/storefront source replaces the published Storefront packages used by Console and API:

flb-package-linker enable storefront
flb-package-linker install storefront

The linker updates the local Console and API manifests for development. To inspect the current link state:

flb-package-linker status
flb-package-linker doctor

If the linker is not installed yet, install it once from the Fleetbase repository root:

npm link

After linking backend package changes, reload the running API worker so Laravel Octane picks up PHP changes:

docker compose exec application php artisan octane:reload

For frontend changes, run the Fleetbase Console dev server as described in the development setup guide; linked Ember packages are watched and live-reloaded by the dev server.

Package Commands

Run the Ember engine locally:

pnpm start

Build the Ember engine:

pnpm build

Run frontend lint and tests:

pnpm lint
pnpm test
pnpm test:ember

Run backend checks:

composer test:lint
composer test:types
composer test:unit
composer test

Configuration

Storefront configuration is provided through the Laravel package config files and environment variables:

  • server/config/storefront.php: API routing, Storefront app verification settings, database connection, and request throttling.
  • server/config/api.php: Storefront API configuration.
  • server/config/database.connections.php: Storefront database connection defaults.

Important environment variables include:

Variable Purpose
STOREFRONT_DB_CONNECTION Database connection name for Storefront models.
STOREFRONT_BYPASS_VERIFICATION_CODE Development bypass code for Storefront app verification flows.
STOREFRONT_THROTTLE_REQUESTS_PER_MINUTE Public Storefront API request limit.
STOREFRONT_THROTTLE_DECAY_MINUTES Public Storefront API throttle decay window.

For customer app configuration, see the Storefront App configuration docs.

Documentation

Contributing

Storefront follows the same review expectations as the rest of Fleetbase:

  • Keep changes small and reviewable.
  • Preserve existing architecture and naming conventions.
  • Add or update tests when practical.
  • Run the relevant frontend or backend validation commands before opening a pull request.
  • For API behavior changes, check whether the API specification and public documentation also need updates.

See CONTRIBUTING.md for general contribution guidance.

License

Fleetbase Storefront is open-source software licensed under the AGPL-3.0-or-later.