Spree setup

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Spree setup is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Bootstrap a new Spree project — `create-spree-app` CLI (v5.2+), `spree-starter` Rails backend, the Next.js storefront repo, `bin/rails g spree:install`, sample data, Docker Compose, and the PostgreSQL + Redis + Sidekiq prerequisites. Use when starting a new Spree project from scratch or onboarding a

How to use this skill

Skill file

Spree Setup

Before writing code

Fetch live docs:

  1. Fetch https://spreecommerce.org/docs/developer/cli/quickstart for the current create-spree-app flags and Node/Ruby version requirements.
  2. Fetch https://github.com/spree/spree-starter (README) for the Rails-backend starter setup.
  3. Fetch https://github.com/spree/storefront (README) for the Next.js storefront prerequisites.
  4. Web-search the latest release tag at https://github.com/spree/spree/releases — confirm the current minor version and matching spree-starter / storefront branch.
  5. Check the v5.2 announcement (https://spreecommerce.org/announcing-spree-5-2/) for CLI changes if working on an older project.

Conceptual Architecture

Two Repos, One Project

A modern Spree project typically combines:

  1. spree-starter (Rails 7+) — the backend application running the spree umbrella gem, admin, APIs, webhooks
  2. storefront (Next.js 16+) — the headless storefront talking to the Rails backend over API v3

The create-spree-app CLI scaffolds both. Older projects often have only the Rails app — the headless storefront is opt-in.

Prerequisites

What `spree:install` Does

The Spree installer initializes:

Bootstrap Sequences

Path A — create-spree-app (recommended in v5.2+):

npx create-spree-app@latest my-store
cd my-store
# Follow prompts: backend? storefront? Docker? sample data?

Path B — Clone spree-starter directly:

git clone https://github.com/spree/spree-starter my-store
cd my-store
docker compose up -d        # PostgreSQL + Redis + MeiliSearch
bin/setup                    # bundle install, db:create, db:migrate, spree:install

Path C — Add Spree to an existing Rails app:

bundle add spree
bundle add spree_admin       # optional: admin dashboard
bundle add spree_emails      # optional: transactional emails
bin/rails g spree:install
bin/rails db:migrate

Adding the Next.js Storefront

git clone https://github.com/spree/storefront my-storefront
cd my-storefront
cp .env.example .env.local
# Set SPREE_API_URL and NEXT_PUBLIC_SPREE_PUBLISHABLE_KEY
npm install
npm run dev   # http://localhost:3000

The publishable key (pk_…) comes from your Spree admin → Settings → API Keys.

Sample Data

bin/rails spree_sample:load

Loads ~25 demo products, taxonomies, payment methods, shipping methods. Idempotent unless --force. Useful for dev, never run in production.

Docker Compose (from spree-starter)

The starter ships a docker-compose.yml with:

Environment Variables

| Var | Purpose |

|-----|---------|

| DATABASE_URL | Postgres connection string |

| REDIS_URL | Redis connection (used by Sidekiq, cache, Action Cable) |

| SECRET_KEY_BASE | Rails session/cookie signing key |

| RAILS_MASTER_KEY | For config/credentials.yml.enc |

| MEILISEARCH_HOST, MEILISEARCH_API_KEY | v5.4+ search backend |

| SPREE_API_URL | Storefront's URL to hit the Rails backend |

| NEXT_PUBLIC_SPREE_PUBLISHABLE_KEY | Public publishable key (pk_…) for the storefront |

Setup Decision Checklist

Common Setup Failures

Always re-verify against the live spree-starter README — bootstrap commands and Docker compose versions move quickly.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.