定制 fleetbase/storefront-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fleetbase/storefront-api

Composer 安装命令:

composer require fleetbase/storefront-api

包简介

Headless Commerce & Marketplace Extension for Fleetbase

README 文档

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.

fleetbase/storefront-api 适用场景与选型建议

fleetbase/storefront-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25.98k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2023 年 05 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「e-commerce」 「marketplace」 「storefront」 「headless commerce」 「fleetbase-extension」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 fleetbase/storefront-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fleetbase/storefront-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 fleetbase/storefront-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 25.98k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 29
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2023-05-17