create-spree-app 0.3.3 → 0.5.0

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.
Files changed (3) hide show
  1. package/README.md +37 -32
  2. package/dist/index.js +108 -180
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-spree-app
2
2
 
3
- Scaffold a new [Spree](https://spreecommerce.org) project with a single command. Backend runs via Docker using pre-built images
3
+ Scaffold a new [Spree Commerce](https://spreecommerce.org) project with a single command. Backend runs via Docker using pre-built images, with a full Rails app included for customization.
4
4
 
5
5
  ## Quick Start
6
6
 
@@ -10,7 +10,7 @@ npx create-spree-app my-store
10
10
 
11
11
  This will walk you through an interactive setup:
12
12
 
13
- 1. Choose **Full-stack** (Backend + Next.js Storefront) or **Backend only**
13
+ 1. Include **Next.js Storefront** (default: yes)
14
14
  2. Optionally load sample data (products, categories, images)
15
15
  3. Optionally start Docker services immediately
16
16
 
@@ -19,14 +19,15 @@ This will walk you through an interactive setup:
19
19
  For non-interactive usage:
20
20
 
21
21
  ```bash
22
- npx create-spree-app my-store --backend-only --no-sample-data --no-start
22
+ npx create-spree-app my-store --no-storefront --no-sample-data --no-start
23
23
  ```
24
24
 
25
25
  | Flag | Description |
26
26
  |------|-------------|
27
- | `--backend-only` | Skip storefront setup |
27
+ | `--no-storefront` | Skip Next.js storefront setup |
28
28
  | `--no-sample-data` | Skip loading sample products |
29
29
  | `--no-start` | Don't start Docker services |
30
+ | `--port <number>` | Port for the Spree backend (default: `3000`) |
30
31
  | `--use-npm` | Use npm as package manager |
31
32
  | `--use-yarn` | Use yarn as package manager |
32
33
  | `--use-pnpm` | Use pnpm as package manager |
@@ -35,13 +36,20 @@ npx create-spree-app my-store --backend-only --no-sample-data --no-start
35
36
 
36
37
  ```
37
38
  my-store/
38
- ├── docker-compose.yml # Spree backend + Postgres
39
- ├── .env # SECRET_KEY_BASE, port, version tag
39
+ ├── docker-compose.yml # Spree backend (prebuilt image) + Postgres + Redis
40
+ ├── docker-compose.dev.yml # Alternative: build from local backend/
41
+ ├── .env # SECRET_KEY_BASE, SPREE_PORT
40
42
  ├── .gitignore
41
- ├── package.json # @spree/cli + convenience scripts
42
- ├── README.md # Getting started guide
43
+ ├── package.json # @spree/cli + convenience scripts
44
+ ├── README.md
45
+ ├── backend/ # Full Rails app (from spree/spree-starter)
46
+ │ ├── Gemfile
47
+ │ ├── Dockerfile
48
+ │ ├── config/
49
+ │ ├── app/
50
+ │ └── ...
43
51
  └── apps/
44
- └── storefront/ # Next.js app (full-stack mode only)
52
+ └── storefront/ # Next.js app (unless --no-storefront)
45
53
  ```
46
54
 
47
55
  ## Prerequisites
@@ -62,7 +70,7 @@ Open http://localhost:3000/admin
62
70
 
63
71
  http://localhost:3000/api/v3/store
64
72
 
65
- ### Storefront (full-stack mode)
73
+ ### Storefront
66
74
 
67
75
  ```bash
68
76
  cd my-store/apps/storefront
@@ -71,6 +79,22 @@ npm run dev
71
79
 
72
80
  Open http://localhost:3001
73
81
 
82
+ ## Customizing the Backend
83
+
84
+ The `backend/` directory contains a full Rails application with Spree installed. By default, the project uses a prebuilt Docker image. To switch to building from your local backend:
85
+
86
+ ```bash
87
+ npx spree eject
88
+ ```
89
+
90
+ This rebuilds the Docker image from `backend/` and restarts services. You can then:
91
+
92
+ - **Add gems** to `backend/Gemfile`
93
+ - **Override models** with decorators in `backend/app/models/`
94
+ - **Add controllers** in `backend/app/controllers/`
95
+ - **Configure Spree** in `backend/config/initializers/spree.rb`
96
+ - **Add migrations** with `cd backend && bin/rails generate migration`
97
+
74
98
  ## Useful Commands
75
99
 
76
100
  Run these from your project directory (powered by [`@spree/cli`](https://www.npmjs.com/package/@spree/cli)):
@@ -79,36 +103,17 @@ Run these from your project directory (powered by [`@spree/cli`](https://www.npm
79
103
  |---------|-------------|
80
104
  | `npm run dev` | Start backend services and stream logs |
81
105
  | `npm run stop` | Stop backend services |
82
- | `npm run down` | Stop and remove backend services |
83
- | `npm run update` | Pull latest Spree image and restart (runs migrations automatically) |
106
+ | `npm run eject` | Switch from prebuilt image to local backend builds |
107
+ | `npm run update` | Pull latest Spree image and restart |
84
108
  | `npm run logs` | View backend logs |
85
- | `npm run logs:worker` | View background jobs logs |
86
109
  | `npm run console` | Rails console |
87
- | `npm run seed` | Seed the database |
88
- | `npm run load-sample-data` | Load sample products, categories |
89
110
 
90
111
  You can also use the CLI directly for additional commands:
91
112
 
92
113
  ```bash
93
114
  npx spree user create # Create an admin user
94
115
  npx spree api-key create # Create an API key
95
- npx spree api-key list # List API keys
96
- ```
97
-
98
- ## Updating Spree
99
-
100
- To update to the latest Spree version:
101
-
102
- ```bash
103
- npm run update
104
- ```
105
-
106
- This pulls the latest Docker image and recreates the containers. The entrypoint automatically runs `db:prepare`, which handles any pending database migrations.
107
-
108
- To pin a specific version, edit `SPREE_VERSION_TAG` in `.env`:
109
-
110
- ```
111
- SPREE_VERSION_TAG=5.4
116
+ npx spree api-key list # List API keys
112
117
  ```
113
118
 
114
119
  ## Learn More