Storefront Commands
The Finqu CLI includes a set of commands for developing custom storefronts using Puck editor and Next.js. These commands are grouped under finqu storefront.
Overview
| Command | Description |
|---|---|
finqu storefront build | Build Puck configuration from component files |
finqu storefront dev | Start development server with hot reload |
finqu storefront create | Create a new Finqu storefront project |
finqu storefront build
Scans your components directory for *.puck.tsx files and generates Puck configuration files.
Usage
finqu storefront build [options]Options
| Option | Description | Default |
|---|---|---|
-c, --components <path> | Path to components directory | components |
-o, --output <path> | Output directory for generated config | .storefront |
What it does
- Scans the components directory for
*.puck.tsxfiles - Extracts component metadata (name, category) from each file
- Generates two Puck configuration files:
puck.edit.config.tsx- For the Puck editor (includes"use client"directive)puck.render.config.tsx- For server-side rendering (no client directive, RSC-compatible)
Component File Patterns
The build command supports two component patterns:
Single file components:
components/
Hero.puck.tsx
TextBlock.puck.tsxFolder-based components with variants:
components/
Marketing/
Marketing.edit.puck.tsx # Editor-specific version
Marketing.render.puck.tsx # Server render version
index.ts # Re-exportsWhen using folder-based components:
- The edit config imports from
*.edit.puck.tsxfiles - The render config imports from
*.render.puck.tsxfiles - Falls back to the available variant if only one exists
Component Categories
Components can export a category constant to be grouped in the Puck editor:
export const category = "Marketing";
export const config: ComponentConfig<HeroProps> = {
label: "Hero Banner",
// ...
};Example
# Build with defaults
finqu storefront build
# Custom paths
finqu storefront build --components src/puck-components --output .generatedfinqu storefront dev
Starts a development environment with automatic rebuilding and Next.js dev server.
Usage
finqu storefront dev [options]Options
| Option | Description | Default |
|---|---|---|
-c, --components <path> | Path to components directory | components |
-o, --output <path> | Output directory for generated config | .storefront |
-p, --port <number> | Port for Next.js dev server | 3000 |
What it does
- Runs an initial build to generate Puck configs
- Starts the Next.js development server
- Watches for changes to
*.puck.tsxfiles - Automatically rebuilds configs when components are added, changed, or removed
Example
# Start dev server with defaults
finqu storefront dev
# Custom port
finqu storefront dev --port 4000
# Custom paths
finqu storefront dev --components src/components --output .puckfinqu storefront create
Scaffolds a new Finqu storefront project with Next.js, Puck editor, and example components.
Usage
finqu storefront create [project-name] [options]Arguments
| Argument | Description |
|---|---|
project-name | Name of the project (optional, will prompt if not provided) |
Options
| Option | Description |
|---|---|
-t, --template <url> | Git repository URL to use as template |
-b, --branch <branch> | Branch to clone (default: main) |
--embedded | Use embedded templates instead of git clone |
What it does
- Creates a new directory with the project name
- Clones the template repository (or uses embedded templates as fallback)
- Updates
package.jsonwith the project name - Initializes a fresh git repository
Project Structure
The created project includes:
my-storefront/
├── app/
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page with Puck Render
│ └── editor/
│ └── page.tsx # Puck editor page
├── components/
│ ├── Hero.puck.tsx # Example Hero component
│ └── TextBlock.puck.tsx # Example TextBlock component
├── .gitignore
├── next.config.ts
├── package.json
├── tsconfig.json
└── vercel.jsonGenerated package.json Scripts
{
"scripts": {
"dev": "finqu storefront dev",
"build": "finqu storefront build && next build",
"start": "next start",
"lint": "next lint"
}
}Example
# Interactive mode (prompts for project name)
finqu storefront create
# With project name
finqu storefront create my-storefront
# With custom template
finqu storefront create my-store --template https://github.com/org/custom-template.git
# Use embedded templates (no git required)
finqu storefront create my-store --embeddedProject Name Requirements
- Must contain only lowercase letters, numbers, and hyphens
- Cannot be empty
Typical Workflow
- Create a new project:
finqu storefront create my-storefront
cd my-storefront
npm install- Start development:
npm dev
# or directly:
finqu storefront dev-
Add components:
- Create
*.puck.tsxfiles in thecomponents/directory - The dev server will automatically rebuild the config
- Create
-
Build for production:
npm build
# This runs: finqu storefront build && next buildTechnical Notes
- The generated config files are placed in
.storefront/by default - The
.storefront/directory should be added to.gitignore - The
tsconfig.jsonincludes.storefront/**/*.tsxin the TypeScript compilation - Edit config uses
"use client"directive for Puck editor interactivity - Render config omits the directive to support React Server Components
Next Steps
- Storefront Overview - Learn about building storefronts
- CLI Overview - General CLI documentation
- Configuration - Configuration reference