@spree/docs 0.1.290 → 0.1.292
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.
|
@@ -18,7 +18,7 @@ The CLI walks you through an interactive setup:
|
|
|
18
18
|
|
|
19
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
20
|
|
|
21
|
-
The **dashboard** and the
|
|
21
|
+
The **admin dashboard** is included in every project (skip it with `--no-dashboard` and the API still serves the built-in one at `/dashboard`). The installer asks whether to add the **seller panel** — a dedicated panel where marketplace vendors manage their products, orders and settings. Answer yes only if you run a marketplace; you can add it later with `spree add seller-dashboard`.
|
|
22
22
|
|
|
23
23
|
## Prerequisites
|
|
24
24
|
|
|
@@ -30,14 +30,14 @@ The **dashboard** and the marketplace **seller panel** are included in every pro
|
|
|
30
30
|
All prompts can be skipped with flags for non-interactive (CI/CD) usage:
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
npx create-spree-app@latest my-store --no-
|
|
33
|
+
npx create-spree-app@latest my-store --no-seller-dashboard --no-storefront --no-start
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
| Flag | Description |
|
|
37
37
|
|------|-------------|
|
|
38
|
-
| `--
|
|
38
|
+
| `--no-dashboard` | Skip the admin dashboard app — the API still serves the built-in one at `/dashboard` |
|
|
39
|
+
| `--no-seller-dashboard` | Skip the marketplace seller panel |
|
|
39
40
|
| `--no-storefront` | Skip Next.js storefront setup |
|
|
40
|
-
| `--no-sample-data` | Skip loading sample products and categories |
|
|
41
41
|
| `--no-start` | Don't start Docker services after scaffolding |
|
|
42
42
|
| `--port <number>` | Port for the Spree backend (default: `3000`) |
|
|
43
43
|
| `--use-npm` | Use npm as package manager |
|
|
@@ -58,9 +58,9 @@ my-store/
|
|
|
58
58
|
│ ├── Dockerfile # Also builds the production image (API + dashboard)
|
|
59
59
|
│ └── Gemfile
|
|
60
60
|
├── apps/
|
|
61
|
-
│ ├── dashboard/ # Admin dashboard (
|
|
61
|
+
│ ├── dashboard/ # Admin dashboard (unless --no-dashboard)
|
|
62
62
|
│ │ └── .env.local # Dev proxy target — no credentials
|
|
63
|
-
│ ├── seller-dashboard/ # Seller panel, for marketplaces (
|
|
63
|
+
│ ├── seller-dashboard/ # Seller panel, for marketplaces (unless --no-seller-dashboard)
|
|
64
64
|
│ └── storefront/ # Next.js storefront (unless --no-storefront)
|
|
65
65
|
│ └── .env.local # API URL + publishable key
|
|
66
66
|
├── .env # SECRET_KEY_BASE, encryption keys, SPREE_PORT, SPREE_VERSION_TAG, SPREE_SAMPLE_DATA
|
|
@@ -109,11 +109,12 @@ The project includes [@spree/cli](../cli/quickstart.md) for managing your Spree
|
|
|
109
109
|
|
|
110
110
|
| Command | Description |
|
|
111
111
|
|---------|-------------|
|
|
112
|
-
| `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the
|
|
112
|
+
| `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the Admin Dashboard dev server when `apps/dashboard` exists |
|
|
113
113
|
| `spree stop` | Stop backend services |
|
|
114
114
|
| `spree update` | Pull latest Spree image and restart (runs migrations automatically) |
|
|
115
115
|
| `spree eject` | Switch from prebuilt image to building from `server/` |
|
|
116
|
-
| `spree add dashboard` | Add the
|
|
116
|
+
| `spree add dashboard` | Add the Admin Dashboard to an existing project, to customize it |
|
|
117
|
+
| `spree add seller-dashboard` | Add the marketplace seller panel to an existing project |
|
|
117
118
|
| `spree build --production` | Build the production image — the Spree API plus your dashboard, in one |
|
|
118
119
|
| `spree logs` | View backend logs |
|
|
119
120
|
| `spree logs worker` | View background jobs logs |
|
|
@@ -160,7 +161,7 @@ SPREE_VERSION_TAG=5.4
|
|
|
160
161
|
|
|
161
162
|
## Deployment
|
|
162
163
|
|
|
163
|
-
The project deploys as **one image**: `server/Dockerfile` builds the Spree API together with your
|
|
164
|
+
The project deploys as **one image**: `server/Dockerfile` builds the Spree API together with your Admin Dashboard (when `apps/dashboard` exists), served same-origin at `/dashboard` — no CORS, no cookie configuration, no second service.
|
|
164
165
|
|
|
165
166
|
- **Render** — the `render.yaml` at the project root is a ready Blueprint: one Docker service built straight from your repo, migrations run on boot.
|
|
166
167
|
- **Anywhere else** — `spree build --production` builds the same image locally; push it to a registry and run it on any Docker host.
|
|
@@ -33,6 +33,8 @@ module SpreeAcmeCarrier
|
|
|
33
33
|
preference :test_mode, :boolean, default: true
|
|
34
34
|
|
|
35
35
|
def self.integration_group = 'shipping'
|
|
36
|
+
def self.logo_url = 'https://acme-carrier.example.com/logo.svg'
|
|
37
|
+
def self.docs_url = 'https://acme-carrier.example.com/docs/spree'
|
|
36
38
|
|
|
37
39
|
# Called when an admin activates the integration. Returning false blocks
|
|
38
40
|
# activation and shows your message in the dashboard.
|
|
@@ -51,6 +53,8 @@ module SpreeAcmeCarrier
|
|
|
51
53
|
end
|
|
52
54
|
```
|
|
53
55
|
|
|
56
|
+
`logo_url` and `docs_url` are optional. They put your logo and a "Setup guide" link on the integration's card under **Settings > Integrations**. Payment methods declare them the same way.
|
|
57
|
+
|
|
54
58
|
Declare secrets as `:password` preferences. Spree masks them on read and guards the round-trip on write, so an API key never leaves the server in plain text.
|
|
55
59
|
|
|
56
60
|
## 2. Implement the provider
|
|
@@ -43,6 +43,24 @@ end
|
|
|
43
43
|
|
|
44
44
|
After restarting your server, you can select "MyGateway" when creating a new payment method in the admin panel under **Settings > Payments**.
|
|
45
45
|
|
|
46
|
+
### Show a logo and setup guide (optional)
|
|
47
|
+
|
|
48
|
+
Payment providers also appear in the admin dashboard under **Settings > Integrations**. Declare a logo and a link to your setup guide so merchants recognise the provider and know how to connect it:
|
|
49
|
+
|
|
50
|
+
```ruby app/models/my_gateway.rb
|
|
51
|
+
class MyGateway < Spree::PaymentMethod
|
|
52
|
+
def self.logo_url
|
|
53
|
+
'https://my-gateway.example.com/logo.svg'
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.docs_url
|
|
57
|
+
'https://my-gateway.example.com/docs/spree'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`logo_url` accepts anything an image tag accepts, including a `data:` URI if you don't want to host the file. Both are optional: without a logo the card shows the provider's first letter, and without a guide the link is hidden. Integrations declare the same two methods — see [custom delivery rate providers](custom-delivery-rate-provider.md).
|
|
63
|
+
|
|
46
64
|
## Step 3: Add Payment Session Support
|
|
47
65
|
|
|
48
66
|
Payment Sessions are the modern, PCI-compliant way to handle payments. Your gateway creates a session with the provider, the frontend collects payment details using the provider's SDK, and Spree records the result.
|