@spree/docs 0.1.128 → 0.1.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -429,6 +429,31 @@ Here's a list of all places you can inject your custom code:
429
429
  </details>
430
430
 
431
431
 
432
+ <details>
433
+ <summary>Customer Page Sidebar</summary>
434
+
435
+ `user_page_sidebar`
436
+
437
+ #### Variables
438
+
439
+ - **`user`** (`Spree.user_class`) — The customer displayed on the page.
440
+
441
+ Injects a section into the customer detail page sidebar. This partial has access to the `user` variable.
442
+
443
+ ```erb
444
+ <div class="card">
445
+ <div class="card-header">
446
+ <h5 class="card-title">Account review</h5>
447
+ </div>
448
+ <div class="card-body">
449
+ <%= user.email %>
450
+ </div>
451
+ </div>
452
+ ```
453
+
454
+ </details>
455
+
456
+
432
457
  ### Stock Items
433
458
 
434
459
  <details>
@@ -36,7 +36,7 @@ pnpm install # workspace dependencies
36
36
  pnpm server:setup # ~5–10 min on first run; idempotent
37
37
  ```
38
38
 
39
- `pnpm server:setup` clones [spree-starter](https://github.com/spree/spree-starter) into `./server/`, wires it to load Spree gems from the monorepo via a Docker compose overlay, builds the dev image, starts the stack (Postgres + Redis + Meilisearch + Rails `web` + Sidekiq `worker`), and prepares the database. The full sequence lives in `scripts/server-setup.sh`.
39
+ `pnpm server:setup` clones [spree-starter](https://github.com/spree/spree-starter) into `./server/`, wires it to load Spree gems from the monorepo via a Docker compose overlay, builds the dev image, starts the stack (Postgres + Meilisearch + a single Rails `web` container background jobs run in-process via Solid Queue), and prepares the database. The full sequence lives in `scripts/server-setup.sh`.
40
40
 
41
41
  When it's done, the backend is up at [http://localhost:3000](http://localhost:3000) and the admin is at [http://localhost:3000/admin](http://localhost:3000/admin). Sign in with the seed admin: **`spree@example.com`** / **`spree123`** (override at seed time with `ADMIN_EMAIL` / `ADMIN_PASSWORD` env vars — see `spree/core/app/services/spree/seeds/admin_user.rb`).
42
42
 
@@ -95,7 +95,7 @@ If you prefer the fastest possible inner loop and don't mind installing Ruby, Po
95
95
  pnpm server:create # clones spree-starter, writes server/.env with SPREE_PATH=..
96
96
  cd server
97
97
  bin/setup # installs Ruby (via mise), Postgres/Redis/Meilisearch (via brew bundle on macOS), gems, prepares the database
98
- bin/dev # starts Rails + Sidekiq + CSS watchers via Foreman
98
+ bin/dev # starts Rails (jobs run in-process) + CSS watchers via Foreman
99
99
  ```
100
100
 
101
101
  This path is faster per request but means more on your host. It also runs against your installed system services, not a sandboxed Docker stack.
@@ -187,7 +187,7 @@ Spree::Admin::RuntimeConfig.reports_line_items_limit = 100
187
187
  By default, report jobs run on the `:default` queue. To route them to a dedicated queue, configure your job processor:
188
188
 
189
189
  ```ruby
190
- # Sidekiq example
190
+ # ActiveJob example
191
191
  Spree.queues.reports = :reports
192
192
  ```
193
193
 
@@ -16,12 +16,14 @@ The CLI walks you through an interactive setup:
16
16
  2. Optionally load **sample data** (products, categories, images)
17
17
  3. Optionally **start Docker services** immediately
18
18
 
19
- Once complete, your store is running at [http://localhost:3000](http://localhost:3000).
19
+ Once complete, your store is running at [http://localhost:3000](http://localhost:3000) — setup pulls the latest Spree image, seeds the database, and configures API keys, then prints a summary with your admin credentials and keys. If you skipped starting services, the first `pnpm dev` completes setup automatically.
20
+
21
+ The **React Dashboard** (Developer Preview of the next-generation admin) is available with the `--react-dashboard` flag, or later via `spree add dashboard`.
20
22
 
21
23
  ## Prerequisites
22
24
 
23
25
  - [Node.js](https://nodejs.org/) 20 or later
24
- - [Docker](https://docs.docker.com/get-docker/) (for running the Spree backend, PostgreSQL, Redis, and Meilisearch)
26
+ - [Docker](https://docs.docker.com/get-docker/) (for running the Spree backend, PostgreSQL, and Meilisearch)
25
27
 
26
28
  ## CLI Flags
27
29
 
@@ -33,6 +35,7 @@ npx create-spree-app@latest my-store --no-storefront --no-sample-data --no-start
33
35
 
34
36
  | Flag | Description |
35
37
  |------|-------------|
38
+ | `--react-dashboard` | Include the React Dashboard (Developer Preview — also available later via `spree add dashboard`) |
36
39
  | `--no-storefront` | Skip Next.js storefront setup |
37
40
  | `--no-sample-data` | Skip loading sample products and categories |
38
41
  | `--no-start` | Don't start Docker services after scaffolding |
@@ -49,35 +52,39 @@ npx create-spree-app@latest my-store --no-storefront --no-sample-data --no-start
49
52
 
50
53
  ```text
51
54
  my-store/
52
- ├── docker-compose.yml # Spree backend (prebuilt image) + Postgres + Redis + Meilisearch
55
+ ├── docker-compose.yml # Spree backend (prebuilt image) + Postgres + Meilisearch
53
56
  ├── docker-compose.dev.yml # Alternative: build from local backend/
54
- ├── .env # SECRET_KEY_BASE, SPREE_PORT, SPREE_VERSION_TAG
57
+ ├── render.yaml # Render Blueprint — one Docker service built from this repo
58
+ ├── .env # SECRET_KEY_BASE, SPREE_PORT, SPREE_VERSION_TAG, SPREE_SAMPLE_DATA
59
+ ├── .dockerignore # Keeps the production build context to sources
55
60
  ├── .gitignore
56
61
  ├── package.json # Convenience scripts
57
62
  ├── README.md
58
- ├── backend/ # Full Rails app (from spree/spree-starter)
63
+ ├── backend/ # Full Rails app — the Spree API (from spree/spree-starter)
59
64
  │ ├── Gemfile
60
- │ ├── Dockerfile
65
+ │ ├── Dockerfile # Also builds the production image (API + dashboard)
61
66
  │ ├── config/
62
67
  │ ├── app/
63
68
  │ └── ...
64
69
  └── apps/
65
- └── storefront/ # Next.js storefront (unless --no-storefront)
66
- ├── .env.local # API URL + API key
70
+ ├── storefront/ # Next.js storefront (unless --no-storefront)
71
+ ├── .env.local # API URL + API key
72
+ │ └── ...
73
+ └── dashboard/ # React Dashboard (with --react-dashboard)
74
+ ├── .env.local # Dev proxy target — no credentials
67
75
  └── ...
68
76
  ```
69
77
 
70
78
  ### What's in docker-compose.yml
71
79
 
72
- - **Spree** — `web` (Rails) + `worker` (Sidekiq) running the `ghcr.io/spree/spree:latest` image on the configured port (default `3000`)
80
+ - **Spree** — one `web` container running the `ghcr.io/spree/spree:latest` image on the configured port (default `3000`); background jobs run in-process via Solid Queue (stored in Postgres — job dashboard at `/jobs`)
73
81
  - **PostgreSQL 18** — database with persistent volume
74
- - **Redis 7** — caching, background jobs, and Action Cable
75
82
  - **Meilisearch** — search engine
76
- - Health checks on postgres, redis, meilisearch, and web
83
+ - Health checks on postgres, meilisearch, and web
77
84
 
78
- ## Customizing the Backend
85
+ ## Customizing the Spree API
79
86
 
80
- The `backend/` directory contains a full Rails application with Spree installed (cloned from [spree-starter](https://github.com/spree/spree-starter)). By default, the project uses a prebuilt Docker image. To switch to building from your local backend:
87
+ The `backend/` directory is the Spree API — a full Rails application with Spree installed (cloned from [spree-starter](https://github.com/spree/spree-starter)) serving the Store and Admin APIs your storefront and dashboard talk to, plus background jobs and transactional emails. By default, the project runs it from a prebuilt Docker image. To switch to building from your local copy:
81
88
 
82
89
  ```bash
83
90
  npx spree eject
@@ -99,10 +106,12 @@ The project includes [@spree/cli](../cli/quickstart.md) for managing your Spree
99
106
 
100
107
  | Command | Description |
101
108
  |---------|-------------|
102
- | `spree dev` | Run the backend in the foreground — streams logs, Ctrl+C stops it |
109
+ | `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the React Dashboard dev server when `apps/dashboard` exists |
103
110
  | `spree stop` | Stop backend services |
104
111
  | `spree update` | Pull latest Spree image and restart (runs migrations automatically) |
105
112
  | `spree eject` | Switch from prebuilt image to building from `backend/` |
113
+ | `spree add dashboard` | Add the React Dashboard to an existing project |
114
+ | `spree build --production` | Build the production image — the Spree API plus your dashboard, in one |
106
115
  | `spree logs` | View backend logs |
107
116
  | `spree logs worker` | View background jobs logs |
108
117
  | `spree console` | Rails console |
@@ -118,6 +127,8 @@ Open [http://localhost:3000/admin](http://localhost:3000/admin) and log in with:
118
127
  | **Email** | `spree@example.com` |
119
128
  | **Password** | `spree123` |
120
129
 
130
+ With `--react-dashboard`, the React Dashboard's dev server is the admin instead: `spree dev` starts it alongside the API at [http://localhost:5173](http://localhost:5173) — same credentials, live-reloading from `apps/dashboard/` (the classic admin remains at `/admin`). See the [React Dashboard docs](../dashboard/overview.md).
131
+
121
132
  ### Store API
122
133
 
123
134
  The REST API is available at [http://localhost:3000/api/v3/store](http://localhost:3000/api/v3/store). See the [API Reference](/api-reference) for details.
@@ -149,6 +160,15 @@ To pin a specific version, edit `SPREE_VERSION_TAG` in `.env`:
149
160
  SPREE_VERSION_TAG=5.4
150
161
  ```
151
162
 
163
+ ## Deployment
164
+
165
+ The project deploys as **one image**: `backend/Dockerfile` builds the Spree API together with your React Dashboard (when `apps/dashboard` exists), served same-origin at `/dashboard` — no CORS, no cookie configuration, no second service.
166
+
167
+ - **Render** — the `render.yaml` at the project root is a ready Blueprint: one Docker service built straight from your repo, migrations run on boot.
168
+ - **Anywhere else** — `spree build --production` builds the same image locally; push it to a registry and run it on any Docker host.
169
+
170
+ See the [Deployment Guide](../deployment.md) and the [dashboard deployment docs](../dashboard/deployment.md).
171
+
152
172
  ## Next Steps
153
173
 
154
174
 
@@ -22,16 +22,13 @@ The official image contains the *stock* dashboard. Once you've customized yours
22
22
  spree build --production # optionally --tag registry/repo:tag
23
23
  ```
24
24
 
25
- The command detects `apps/dashboard/`, selects the Dockerfile's `custom` dashboard stage (`--build-arg DASHBOARD_SOURCE=custom`), and passes your app as a named build context the Node toolchain lives only in that throw-away stage, and the final image is Rails plus your built `dist/` served at `/dashboard`. Without the CLI, the equivalent is:
25
+ The Dockerfile normalizes its own build context: built from the project root it detects the layout (`backend/` = the Rails app, `apps/dashboard/` = your dashboard) and builds *your* dashboard into the image no flags, no named contexts. Without the CLI, the equivalent is:
26
26
 
27
27
  ```bash
28
- docker build backend/ -f backend/Dockerfile \
29
- --build-arg DASHBOARD_SOURCE=custom \
30
- --build-context dashboard-src=./apps/dashboard \
31
- -t my-shop-spree:latest
28
+ docker build . -f backend/Dockerfile -t my-shop-spree:latest
32
29
  ```
33
30
 
34
- Inside the stage the build runs with `VITE_BASE_PATH=/dashboard/` (asset URLs resolve under the mount) and `VITE_SPREE_API_URL` unset (API calls stay origin-relative). Projects **without** `apps/dashboard/` build exactly what plain `docker build backend/` produces — and if your `backend/Dockerfile` predates dashboard support, the command warns instead of silently shipping the stock dashboard over your customized one.
31
+ Inside the dashboard stage the build runs with `VITE_BASE_PATH=/dashboard/` (asset URLs resolve under the mount) and `VITE_SPREE_API_URL` unset (API calls stay origin-relative); the Node toolchain lives only in that throw-away stage. Projects **without** `apps/dashboard/` get the stock dashboard baked instead — and if your `backend/Dockerfile` predates this layout support, the command warns instead of silently shipping the stock dashboard over your customized one (update it from the spree-starter template).
35
32
 
36
33
  ## Static host / CDN — the alternative
37
34
 
@@ -52,16 +49,15 @@ A middle ground also works: serve `dist/` and proxy `/api/*` + `/rails/*` to Rai
52
49
 
53
50
  ## Render
54
51
 
55
- If your project deploys to Render via the Blueprint that `create-spree-app` places at the project root, `spree add dashboard` wires the single-node topology automatically: it extends the backend service's `buildCommand` to also build `apps/dashboard` (Render's Ruby runtime includes Node, and the full repo is available during the build) and adds one env var so the server serves the result:
52
+ The Blueprint that `create-spree-app` places at the project root deploys the backend as a **Docker service** built from your repo the same Dockerfile as everywhere else, with the repo root as context:
56
53
 
57
54
  ```yaml
58
- buildCommand: bundle install && … && (cd ../apps/dashboard && corepack enable pnpm && pnpm install && VITE_BASE_PATH=/dashboard/ pnpm build)
59
- envVars:
60
- - key: SPREE_DASHBOARD_DIST_PATH
61
- value: ../apps/dashboard/dist
55
+ runtime: docker
56
+ dockerfilePath: ./backend/Dockerfile
57
+ dockerContext: .
62
58
  ```
63
59
 
64
- That's the whole setup — one service, one origin, **your customized dashboard** (it builds from your `apps/dashboard`, not the stock bundle) at `https://your-service.onrender.com/dashboard`. No `VITE_SPREE_API_URL`, no Allowed Origins entry, no extra service. Redeploys rebuild on every push.
60
+ That's the whole setup — one service, one origin, **your customized dashboard** (it builds from your `apps/dashboard`, not the stock bundle) at `https://your-service.onrender.com/dashboard`. No `VITE_SPREE_API_URL`, no Allowed Origins entry, no extra service, no build commands to maintain — migrations run from the image entrypoint on boot. Redeploys rebuild on every push, and what Render builds is byte-for-byte what `spree build --production` builds locally.
65
61
 
66
62
  If you prefer the dashboard on Render's CDN instead, add a static-site service by hand using the cross-origin recipe above.
67
63