@fleetbase/storefront-engine

中文文档
0.4.31发布于 2026/11/02AGPL-3.0-or-later近 30 天下载 4691

Headless Commerce & Marketplace Extension for Fleetbase

原始使用文档
文档目录21 节
  1. Overview
  2. Features
  3. Customer App
  4. Architecture
  5. Console Modules
  6. API Surface
  7. Public Storefront API
  8. Marketplace network contract
  9. Internal Console API
  10. Getting Started
  11. Requirements
  12. Install Dependencies
  13. Backend Package
  14. Frontend Package
  15. Development
  16. Use Local Storefront Source in Fleetbase
  17. Package Commands
  18. Configuration
  19. Documentation
  20. Contributing
  21. License

Fleetbase Storefront

Logistics-first headless commerce and marketplace infrastructure for Fleetbase.

Documentation | GitHub | Platform Overview | Fleetbase | Launch with AppHelm

License: AGPL-3.0-or-later Coverage 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.

Customer App

A marketplace home: featured stores, categories and stores near the customer

The Storefront App is the open-source customer app for this extension, for iOS, Android, and the web. Customers browse, order, pay, and track deliveries in it, through the public Storefront API.

The easiest way to launch it is Fleetbase AppHelm, which takes a Fleetbase store and publishes it as your own branded app, with no code to write. Connect your store, set your brand, and preview the app with your real products. Publish it free on the web at yourstore.apphelm.io, then go on to the App Store and Google Play: AppHelm walks you through each store's requirements and handles the builds and submission, from your own Apple and Google developer accounts.

Launch with AppHelm See it in action

Source code · Build it yourself

Architecture

This repository contains both sides of the Storefront extension:

AreaPathPurpose
Ember engineaddon/, app/, config/, translations/Fleetbase Console UI, routes, models, components, services, widgets, and translations.
Laravel APIserver/src/, server/config/, server/migrations/Storefront API controllers, models, resources, middleware, providers, observers, notifications, jobs, and database migrations.
Teststests/, 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.

Marketplace network contract

A public network_... key uses accepted network_stores membership as its marketplace authorization boundary, including member stores owned by another company. Marketplace responses expose only public Storefront resources; they do not expose member customers, internal API keys, or gateway credentials.

  • GET storefront/v1/stores supports search, online/tag/category/ID filters, rating/age/popularity/trending/nearest sorts, distance filtering in meters, and limit/offset pagination.
  • Categories and published products can be scoped to a member store. Product responses include public merchant context for marketplace search and cards.
  • Cart line items preserve both merchant and store-location identity. Product and location substitution across stores is rejected.
  • Checkout revalidates active membership, store availability, published products, location ownership, the network multi-cart policy, and one-cart currency before payment begins.
  • Network delivery quotes resolve one origin per represented store and reject missing, foreign, or mismatched locations with 422.
  • When Customer-Token is present, it is authoritative; a conflicting checkout customer ID returns 403.

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

Generate and summarize the full backend Clover baseline with Xdebug or PCOV:

XDEBUG_MODE=coverage composer test:coverage:clover
composer coverage:summary

Marketplace changes on dev-v0.4.19 must retain 100% backend statement coverage. Focused success and failure-path contracts should be added before regenerating the baseline.

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:

VariablePurpose
STOREFRONT_DB_CONNECTIONDatabase connection name for Storefront models.
STOREFRONT_BYPASS_VERIFICATION_CODEInstance-wide sign-in code for the review accounts in STOREFRONT_REVIEW_ACCOUNTS (self-hosted). Stores can instead turn on App Review access in their settings.
STOREFRONT_REVIEW_ACCOUNTSComma-separated phone numbers and emails that sign in with STOREFRONT_BYPASS_VERIFICATION_CODE and are never sent a code.
STOREFRONT_THROTTLE_REQUESTS_PER_MINUTEPublic Storefront API requests allowed per device (store key + client IP) per window. Default 120.
STOREFRONT_THROTTLE_DECAY_MINUTESPublic Storefront API throttle window in minutes. Default 1.

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.

版本与发布记录

@fleetbase/storefront-engine 共发布 95 个版本,首次发布于 2023/05/17;过去 12 个月发布了 25 个版本。

版本发布日期距今
0.4.31latest2026/11/0213 天前
0.4.302026/10/2719 天前
0.4.292026/10/2224 天前
0.4.282026/10/2026 天前
0.4.272026/10/1630 天前
0.4.262026/10/1630 天前

关于 @fleetbase/storefront-engine 的常见问题

@fleetbase/storefront-engine 是什么?

Headless Commerce & Marketplace Extension for Fleetbase

如何安装 @fleetbase/storefront-engine?

在项目目录运行 npm install @fleetbase/storefront-engine,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:ember-engines(^0.9.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fleetbase/storefront-engine 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fleetbase__storefront-engine 是否存在。

@fleetbase/storefront-engine 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fleetbase/storefront-engine 可以商用吗?

@fleetbase/storefront-engine 使用 AGPL-3.0-or-later 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@fleetbase/storefront-engine 的下载量有多少?

根据 npm 官方下载统计,@fleetbase/storefront-engine 在 2026/10/15 – 2026/11/13 这 30 天内被下载 4,691 次,日均约 156 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fleetbase/storefront-engine 还在维护吗?

最新版本 0.4.31 发布于 2026/11/02(13 天前);至今共发布 95 个版本,其中过去 12 个月发布了 25 个;首次发布于 2023/05/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。