create-shopify-firebase-app 2.0.6 → 2.1.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.
- package/README.md +122 -74
- package/lib/index.js +540 -238
- package/lib/preflight.js +358 -0
- package/lib/provision.js +187 -5
- package/package.json +1 -1
- package/templates/js/functions/package.json +6 -6
- package/templates/js/functions/src/admin-api.js +1 -1
- package/templates/js/functions/src/auth.js +45 -13
- package/templates/js/functions/src/firebase.js +6 -4
- package/templates/js/functions/src/index.js +14 -0
- package/templates/shared/extensions/theme-block/blocks/app-block.liquid +1 -1
- package/templates/shared/extensions/theme-block/shopify.extension.toml +1 -1
- package/templates/shared/firebase.json +1 -1
- package/templates/shared/firestore.rules +10 -2
- package/templates/shopify.app.toml +1 -1
- package/templates/ts/functions/package.json +10 -10
- package/templates/ts/functions/src/admin-api.ts +5 -2
- package/templates/ts/functions/src/auth.ts +69 -15
- package/templates/ts/functions/src/firebase.ts +8 -4
- package/templates/ts/functions/tsconfig.json +2 -1
- package/templates/web/css/app.css +78 -1138
- package/templates/web/index.html +79 -68
- package/templates/web/js/app.js +60 -33
- package/templates/web/js/pages/home.js +33 -22
- package/templates/web/js/pages/polaris-demo.js +25 -83
- package/templates/web/js/pages/products.js +100 -114
- package/templates/web/js/pages/settings.js +68 -166
- package/templates/web/polaris.html +1221 -950
- package/templates/web/products.html +35 -40
- package/templates/web/settings.html +69 -17
package/README.md
CHANGED
|
@@ -11,8 +11,9 @@ npx create-shopify-firebase-app my-app
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
|
-
<img src="https://img.shields.io/badge/Shopify-2026--
|
|
14
|
+
<img src="https://img.shields.io/badge/Shopify-2026--07-7AB55C?logo=shopify&logoColor=white" />
|
|
15
15
|
<img src="https://img.shields.io/badge/Firebase-v2%20Functions-FFCA28?logo=firebase&logoColor=black" />
|
|
16
|
+
<img src="https://img.shields.io/badge/Node-22-339933?logo=nodedotjs&logoColor=white" />
|
|
16
17
|
<img src="https://img.shields.io/badge/TypeScript-Functions-3178C6?logo=typescript&logoColor=white" />
|
|
17
18
|
</p>
|
|
18
19
|
|
|
@@ -41,15 +42,18 @@ npx create-shopify-firebase-app my-app
|
|
|
41
42
|
|
|
42
43
|
The **Firebase alternative** to `shopify app init`. Instead of Remix + Prisma + Vercel, you get:
|
|
43
44
|
|
|
44
|
-
- **Firebase v2 Cloud Functions** (gen 2) — 4 independent, auto-scaling
|
|
45
|
+
- **Firebase v2 Cloud Functions** (gen 2, Node 22) — 4 independent, auto-scaling functions
|
|
45
46
|
- **Cloud Firestore** for sessions and app data (auto-scaling, free tier)
|
|
46
47
|
- **Firebase Hosting** for your embedded admin dashboard (free)
|
|
47
|
-
- **
|
|
48
|
+
- **Polaris web components + App Bridge** — 4 pages, no React, no build step
|
|
48
49
|
- **Theme App Extension** for storefront UI (works on all Shopify plans)
|
|
49
|
-
- **Shopify API 2026-
|
|
50
|
-
- **Production-ready** —
|
|
50
|
+
- **Shopify API 2026-07** — OAuth, session tokens, webhooks, GDPR handlers
|
|
51
|
+
- **Production-ready** — deployed and installable when the command finishes
|
|
51
52
|
|
|
52
|
-
One
|
|
53
|
+
One command does the whole thing: signs you in to Shopify, creates the app, creates
|
|
54
|
+
and provisions the Firebase project, deploys it, and hands you an install link.
|
|
55
|
+
No copying Client IDs between dashboards, and no pasting your Client Secret — the
|
|
56
|
+
CLI reads it from the Shopify CLI itself.
|
|
53
57
|
|
|
54
58
|
---
|
|
55
59
|
|
|
@@ -57,11 +61,22 @@ One `npx` command scaffolds everything, installs dependencies, wires up Firebase
|
|
|
57
61
|
|
|
58
62
|
### Prerequisites
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
64
|
-
|
|
|
64
|
+
The CLI checks all of these before it does anything, and offers to install what's missing.
|
|
65
|
+
|
|
66
|
+
| Tool | Install | Required? |
|
|
67
|
+
|------|---------|-----------|
|
|
68
|
+
| Node.js 20+ | [nodejs.org](https://nodejs.org/) | Yes — Cloud Functions run on Node 22 |
|
|
69
|
+
| Firebase CLI | `npm i -g firebase-tools` | Yes — offered automatically if missing |
|
|
70
|
+
| Shopify CLI | `npm i -g @shopify/cli` | Yes — offered automatically if missing |
|
|
71
|
+
| git | [git-scm.com](https://git-scm.com/) | Optional — only for the initial commit |
|
|
72
|
+
| gcloud | [Cloud SDK](https://cloud.google.com/sdk) | Optional — auto-enables the Firestore API |
|
|
73
|
+
|
|
74
|
+
You also need a **Shopify Partner account** and a **Google account**. The CLI signs
|
|
75
|
+
you in to both; you don't need to open either dashboard first.
|
|
76
|
+
|
|
77
|
+
> **Cloud Functions require the Firebase Blaze plan.** It has a generous free tier
|
|
78
|
+
> (2M invocations/month), but a billing account must be attached. That is the one
|
|
79
|
+
> step the CLI cannot do silently for you.
|
|
65
80
|
|
|
66
81
|
### 1. Run the scaffold
|
|
67
82
|
|
|
@@ -69,86 +84,104 @@ One `npx` command scaffolds everything, installs dependencies, wires up Firebase
|
|
|
69
84
|
npx create-shopify-firebase-app my-app
|
|
70
85
|
```
|
|
71
86
|
|
|
72
|
-
The
|
|
87
|
+
The CLI walks the entire flow. This is a real run:
|
|
73
88
|
|
|
74
89
|
```
|
|
75
90
|
🛍️ + 🔥 create-shopify-firebase-app
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
|
|
92
|
+
=== Environment Check ===
|
|
93
|
+
|
|
94
|
+
✔ Node.js v22.20.0
|
|
95
|
+
✔ npm 10.9.4
|
|
96
|
+
✔ git 2.47.1
|
|
97
|
+
✔ Firebase CLI 15.10.0
|
|
98
|
+
✔ Shopify CLI 4.6.0
|
|
99
|
+
✔ gcloud 565.0.0
|
|
100
|
+
✔ Environment ready
|
|
101
|
+
|
|
102
|
+
=== Sign In to Shopify ===
|
|
103
|
+
|
|
104
|
+
ℹ A browser window opens — approve the code shown below.
|
|
105
|
+
✔ Signed in to Shopify
|
|
106
|
+
|
|
107
|
+
=== Choose Your Template ===
|
|
108
|
+
|
|
109
|
+
? What would you like to create?
|
|
110
|
+
❯ Shopify + Firebase app (full-stack serverless)
|
|
111
|
+
Extension-only app (Shopify CLI)
|
|
112
|
+
|
|
113
|
+
=== Project Setup ===
|
|
114
|
+
|
|
115
|
+
? Language for Cloud Functions › TypeScript
|
|
116
|
+
? App name (shown in Shopify admin) › My Store App
|
|
117
|
+
? What API access does your app need? › read_products
|
|
118
|
+
|
|
119
|
+
=== Scaffolding ===
|
|
120
|
+
|
|
121
|
+
✔ Created 33 files in my-store-app/
|
|
122
|
+
|
|
123
|
+
=== Create Your Shopify App ===
|
|
124
|
+
|
|
125
|
+
(the Shopify CLI asks which organization, and lets you create a new app)
|
|
126
|
+
✔ Client ID: 12dfc4d0d6d0b40d85b0f64b80de28af
|
|
127
|
+
✔ Client Secret: shpss_09**************(38 chars)
|
|
104
128
|
|
|
105
129
|
=== Firebase Setup ===
|
|
106
130
|
|
|
107
|
-
|
|
131
|
+
? Which Google account should own this project? › you@gmail.com
|
|
108
132
|
? Select a Firebase project
|
|
109
133
|
❯ [create a new project]
|
|
110
134
|
My Project (my-project-123)
|
|
111
|
-
|
|
135
|
+
[add Firebase to an existing Google Cloud project]
|
|
112
136
|
[enter project ID manually]
|
|
113
137
|
|
|
114
|
-
|
|
138
|
+
✔ Firestore: us-central1
|
|
139
|
+
✔ Web App: My Store App
|
|
140
|
+
✔ Hosting: https://my-store-app.web.app
|
|
141
|
+
✔ Artifact cleanup policy set — 'firebase deploy' will not prompt
|
|
142
|
+
✔ App config written — https://my-store-app.web.app
|
|
143
|
+
|
|
144
|
+
=== Installing & Building ===
|
|
115
145
|
|
|
116
|
-
ℹ Scaffolding project...
|
|
117
|
-
✔ Created 27 files in my-app/
|
|
118
|
-
ℹ Installing dependencies...
|
|
119
146
|
✔ Dependencies installed
|
|
120
|
-
ℹ Building TypeScript...
|
|
121
147
|
✔ TypeScript compiled successfully
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
✔
|
|
126
|
-
|
|
127
|
-
✔ Git repository initialized with first commit
|
|
148
|
+
|
|
149
|
+
=== Going Live ===
|
|
150
|
+
|
|
151
|
+
✔ Deployed to Firebase
|
|
152
|
+
✔ Shopify app updated
|
|
128
153
|
|
|
129
154
|
✔ All done! Your Shopify + Firebase app is ready.
|
|
130
155
|
|
|
131
|
-
|
|
156
|
+
Your app is live. Install it on a dev store:
|
|
132
157
|
|
|
133
|
-
|
|
134
|
-
firebase deploy
|
|
158
|
+
https://my-store-app.web.app/auth?shop=YOUR-STORE.myshopify.com
|
|
135
159
|
```
|
|
136
160
|
|
|
137
|
-
|
|
161
|
+
**You never paste the Client Secret.** The CLI reads it from `shopify app env show`
|
|
162
|
+
once the app exists — which is exactly why the Shopify app is created *before* Firebase.
|
|
138
163
|
|
|
139
|
-
###
|
|
164
|
+
### 2. Install it on a development store
|
|
140
165
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
firebase deploy
|
|
144
|
-
```
|
|
166
|
+
The command prints an install link when it finishes. Open it in a browser with your
|
|
167
|
+
store's domain substituted in:
|
|
145
168
|
|
|
146
|
-
Then install on your dev store by visiting:
|
|
147
169
|
```
|
|
148
|
-
https://
|
|
170
|
+
https://YOUR-PROJECT.web.app/auth?shop=YOUR-STORE.myshopify.com
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Approve the scopes and the app opens embedded in the Shopify admin.
|
|
174
|
+
|
|
175
|
+
### 3. Make changes
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
cd my-store-app
|
|
179
|
+
# edit web/ or functions/src/
|
|
180
|
+
firebase deploy --force
|
|
149
181
|
```
|
|
150
182
|
|
|
151
|
-
Or
|
|
183
|
+
Or develop against a Shopify tunnel with hot reload:
|
|
184
|
+
|
|
152
185
|
```bash
|
|
153
186
|
shopify app dev
|
|
154
187
|
```
|
|
@@ -165,11 +198,11 @@ Most Shopify app developers pay for hosting before they even have users. With Fi
|
|
|
165
198
|
|---|---|---|
|
|
166
199
|
| **Backend** | Remix server (monolith) | Firebase v2 Cloud Functions (4 independent functions) |
|
|
167
200
|
| **Database** | Prisma + PostgreSQL | Cloud Firestore (NoSQL, auto-scaling) |
|
|
168
|
-
| **Frontend** | React + Polaris |
|
|
201
|
+
| **Frontend** | React + Polaris | Polaris web components + App Bridge (no build) |
|
|
169
202
|
| **Hosting** | Vercel / Fly.io / Heroku | Firebase Hosting (free tier) |
|
|
170
|
-
| **Auth** | `@shopify/shopify-app-
|
|
203
|
+
| **Auth** | `@shopify/shopify-app-react-router` | Manual OAuth (~150 lines, you own it) |
|
|
171
204
|
| **Build** | Webpack / Vite | `tsc` (TypeScript compiler, no bundler) |
|
|
172
|
-
| **Deploy** | Varies |
|
|
205
|
+
| **Deploy** | Varies | Done for you — the CLI deploys before it exits |
|
|
173
206
|
| **Cost** | $5-25/month from day one | **$0/month** — free until you scale |
|
|
174
207
|
| **Framework knowledge** | Remix + React required | Express + HTML (that's it) |
|
|
175
208
|
| **Scaling** | Single server | Per-function auto-scaling (Cloud Run) |
|
|
@@ -197,7 +230,7 @@ Most Shopify app developers pay for hosting before they even have users. With Fi
|
|
|
197
230
|
|
|
198
231
|
```
|
|
199
232
|
my-app/
|
|
200
|
-
├── shopify.app.toml # Shopify app config (API 2026-
|
|
233
|
+
├── shopify.app.toml # Shopify app config (API 2026-07)
|
|
201
234
|
├── firebase.json # Firebase Hosting + Functions + Firestore
|
|
202
235
|
├── firestore.rules # Security rules (blocks direct client access)
|
|
203
236
|
│
|
|
@@ -213,10 +246,14 @@ my-app/
|
|
|
213
246
|
│ │ └── config.ts # Environment config
|
|
214
247
|
│ └── .env # Your secrets (auto-generated, git-ignored)
|
|
215
248
|
│
|
|
216
|
-
├── web/ # ── Frontend ──
|
|
217
|
-
│ ├── index.html #
|
|
218
|
-
│ ├──
|
|
219
|
-
│
|
|
249
|
+
├── web/ # ── Frontend (4 pages) ──
|
|
250
|
+
│ ├── index.html # Dashboard
|
|
251
|
+
│ ├── products.html # Product search + detail
|
|
252
|
+
│ ├── settings.html # Form persisted to Firestore
|
|
253
|
+
│ ├── polaris.html # Polaris component reference
|
|
254
|
+
│ ├── js/app.js # App Bridge helper (idToken, apiFetch, toast)
|
|
255
|
+
│ ├── js/pages/ # One module per page
|
|
256
|
+
│ └── css/app.css # Supplementary styles
|
|
220
257
|
│
|
|
221
258
|
└── extensions/ # ── Storefront ──
|
|
222
259
|
└── theme-block/
|
|
@@ -285,11 +322,18 @@ npx create-shopify-firebase-app
|
|
|
285
322
|
# With project name
|
|
286
323
|
npx create-shopify-firebase-app my-app
|
|
287
324
|
|
|
325
|
+
# Skip the deploy steps (scaffold only)
|
|
326
|
+
npx create-shopify-firebase-app my-app --no-deploy
|
|
327
|
+
|
|
328
|
+
# Auto-install any missing CLI tools without asking
|
|
329
|
+
npx create-shopify-firebase-app my-app --yes
|
|
330
|
+
|
|
288
331
|
# Non-interactive (CI/CD)
|
|
289
332
|
npx create-shopify-firebase-app my-app \
|
|
290
333
|
--api-key=abc123 \
|
|
291
334
|
--api-secret=secret \
|
|
292
335
|
--project-id=my-firebase-project \
|
|
336
|
+
--create-project \
|
|
293
337
|
--scopes=read_products,write_products
|
|
294
338
|
|
|
295
339
|
# Help
|
|
@@ -509,9 +553,13 @@ These are **required** for Shopify App Store listing.
|
|
|
509
553
|
|---------|----------|
|
|
510
554
|
| "Missing shop parameter" | Set **App URL** in Partner Dashboard to `https://PROJECT_ID.web.app` |
|
|
511
555
|
| "HMAC verification failed" | Check `SHOPIFY_API_SECRET` in `functions/.env` |
|
|
512
|
-
| "Invalid session token" |
|
|
556
|
+
| "Invalid session token" | Check `SHOPIFY_API_SECRET` in `functions/.env` — the JWT is signed with it |
|
|
513
557
|
| Functions not receiving requests | Check `firebase.json` rewrites match function export names in `index.ts` |
|
|
514
558
|
| Webhook failures | Must respond 200 within 5 seconds. Check `firebase functions:log` |
|
|
559
|
+
| `firebase deploy` exits 1 on a new project | Use `firebase deploy --force` — a bare deploy stalls on the artifact-policy prompt and leaves Hosting unreleased |
|
|
560
|
+
| Firestore create fails with 403 | The Firestore API is not enabled yet: `gcloud services enable firestore.googleapis.com --project=YOUR_ID` |
|
|
561
|
+
| `App name cannot contain "Shopify"` | Shopify rejects those names — pick another (the CLI now strips it automatically) |
|
|
562
|
+
| `shopify app deploy` says "not a member of the organization" | The app was created under a different Shopify account. Run `shopify auth login` |
|
|
515
563
|
| Individual function not deploying | Ensure export name in `index.ts` matches function name in `firebase.json` rewrite |
|
|
516
564
|
|
|
517
565
|
---
|