@@ -28,16 +28,18 @@ The application provides a quick and easy to use shopping experience with featur
28
28
29
29
1 . Create a new Firebase project in the [ Firebase Console] ( https://console.firebase.google.com ) .
30
30
2 . Enable ** Email/Password Authentication** .
31
- 3 . Add Firebase app secrets to ` .env.local ` .
32
- 4 . Include Firebase app secrets in ** App Hosting ** .
31
+ 3 . Replace the relevant commented-out environment variables in ` apphosting.yaml `
32
+ with your firebase config .
33
33
34
34
#### Firebase Data Connect
35
35
36
36
1 . Install the ** Firebase Data Connect** extension for VS Code.
37
37
2 . Create a new Data Connect instance and service.
38
38
3 . Set up billing for the Firebase project.
39
39
4 . Switch to the Blaze plan.
40
- 5 . Define the required schema, queries, and mutations.
40
+ 5 . Modify ` dataconnect/dataconnect.yaml ` to specify ` serviceId ` , ` location ` ,
41
+ ` schema.datasource.postgresql.database ` and
42
+ ` schema.datasource.postgressql.cloudSql.instanceId `
41
43
6 . Deploy the schema, queries, and mutations to production.
42
44
43
45
#### Firebase Storage
@@ -48,13 +50,18 @@ The application provides a quick and easy to use shopping experience with featur
48
50
#### Firebase App Hosting
49
51
50
52
1 . Connect the Firebase app to your GitHub repository.
51
- 2 . Create a new backend for the application.
52
- 3 . Deploy secrets to app hosting using the Firebase CLI.
53
- 4 . Deploy the application to Firebase Hosting.
53
+ 2 . Create a new backend for the application, but do not deploy yet.
54
+ We need to set up environment variables first for the app to work.
54
55
55
56
### Stripe Setup
56
57
57
58
1 . Create a new Stripe account.
59
+ 2 . Follow the instructions in apphosting.yaml to create the
60
+ public and private keys for your stripe application.
61
+ 3 . Create a webhook that listen to "Events on your account" at
62
+ <your domain >/api/stripe/webhook that receives at least
63
+ the following events: ` payment_intent.succeeded ` , ` payment_intent.failed ` ,
64
+ ` charge.succeeded ` , ` charge.updated ` .
58
65
2 . Add API keys (Publishable and Secret) to ` .env.local ` .
59
66
3 . Set up a webhook endpoint in the Firebase project.
60
67
4 . Add the webhook secret to ` .env.local ` .
@@ -63,12 +70,18 @@ The application provides a quick and easy to use shopping experience with featur
63
70
64
71
## Environment Variables
65
72
66
- The following environment variables must be configured in ` .env.local ` :
73
+ The following environment variables must be configured in ` apphosting.yaml `
74
+ (there are comments for where to find these values)
67
75
68
- - ** Firebase Secrets ** : ` NEXT_PUBLIC_FIREBASE_API_KEY ` , ` NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ` , ` NEXT_PUBLIC_FIREBASE_PROJECT_ID ` , ` NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET ` , ` NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID ` , ` NEXT_PUBLIC_FIREBASE_APP_ID ` .
69
- - ** Stripe Secrets ** : ` NEXT_PUBLIC_STRIPE_PUB_KEY ` , ` STRIPE_SECRET_KEY ` , ` STRIPE_WEBHOOK_SECRET `
76
+ - ** Firebase Config ** : ` NEXT_PUBLIC_FIREBASE_API_KEY ` , ` NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ` , ` NEXT_PUBLIC_FIREBASE_PROJECT_ID ` , ` NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET ` , ` NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID ` , ` NEXT_PUBLIC_FIREBASE_APP_ID ` .
77
+ - ** Stripe Config ** : ` NEXT_PUBLIC_STRIPE_PUB_KEY ` , ` STRIPE_SECRET_KEY ` , ` STRIPE_WEBHOOK_SECRET `
70
78
- ** Google/Gemini API Key** : ` GOOGLE_API_KEY `
71
79
80
+ ## Deploy
81
+ Once you have set up Stripe, Data Connect, and configured your App Hosting environment, it's time to deploy!
82
+ If you have automatic rollouts enabled, simply push your changes. Otherwise, after pushing, go to the
83
+ Firebase console and click "Create Rollout".
84
+
72
85
## Application Features
73
86
74
87
### Homepage
@@ -148,18 +161,17 @@ To run this project locally, follow these steps:
148
161
```
149
162
npm install
150
163
```
151
- 4 . Copy the example environment variables:
152
- ```
153
- cp .env.example .env.local
154
- ```
155
- • Fill in the required values (Firebase config, Stripe keys, Google API key, etc.).
156
- 5 . Start the development server:
164
+ 4 . Fill in ` apphosting.yaml ` as guided by the comments.
165
+ 5 . Initialize the firebase emulator suite with ` firebase init emulators ` . You may
166
+ create an ` apphosting.emulator.yaml ` if you choose to use different configurations
167
+ during local development or you can test against your production config.
168
+ 5 . Start the emulator
157
169
```
158
- npm run dev
170
+ firebase emulators:start
159
171
```
160
172
6 . Open the application in your browser at:
161
173
```
162
- http://localhost:3000
174
+ http://localhost:5002
163
175
```
164
176
165
177
---
0 commit comments