@@ -36,18 +36,40 @@ description: >
3636 - Click on "Create database"
3737 - Copy these Firestore rules:
3838
39- ``` plaintext
40- rules_version = '2';
41-
42- service cloud.firestore {
43- match /databases/{database}/documents {
44- // Allow authenticated users to read and write their own user document
45- match /users/{userId} {
46- allow read, write: if request.auth != null && request.auth.uid == userId;
39+ ``` plaintext
40+ rules_version = '2';
41+
42+ service cloud.firestore {
43+ match /databases/{database}/documents {
44+ // Allow authenticated users to read and write their own user document
45+ match /users/{userId} {
46+ allow read, write: if request.auth != null && request.auth.uid == userId;
47+ }
48+ }
4749 }
48- }
49- }
50- ```
50+ ```
51+
52+ 6. **Install Firebase CLI**:
53+ ```bash
54+ npm install -g firebase-tools
55+ ```
56+
57+ 7 . ** Login to Firebase** :
58+ ``` bash
59+ firebase login
60+ ```
61+
62+ 8 . ** Initialize Firebase in your project** :
63+ ``` bash
64+ firebase init
65+ ```
66+
67+ Select the following options:
68+ - Choose "Hosting" when prompted for features
69+ - Select your Firebase project or create a new one
70+ - Set build directory to 'dist' (for Vite projects)
71+ - Configure as a single-page application: Yes
72+ - Don't overwrite index.html
5173
5274## Installation
5375
@@ -110,6 +132,7 @@ Create `src/config.json`:
110132
111133``` json
112134{
135+ "name" : " My SaaS" ,
113136 "firebase" : {
114137 "apiKey" : " your-api-key" ,
115138 "authDomain" : " your-auth-domain" ,
@@ -139,6 +162,16 @@ Create `src/config.json`:
139162 "github" : false ,
140163 "twitter" : false ,
141164 "yahoo" : false
165+ },
166+ "emulators" : {
167+ "enabled" : false ,
168+ "host" : " localhost" ,
169+ "ports" : {
170+ "auth" : 9099 ,
171+ "firestore" : 8080 ,
172+ "functions" : 5001 ,
173+ "hosting" : 5002
174+ }
142175 }
143176}
144177```
@@ -246,27 +279,25 @@ export default App;
246279
247280### Firebase Emulators
248281
249- Add emulator settings to ` config.json ` :
250- ``` json
251- {
252- "emulators" : {
253- "enabled" : true ,
254- "host" : " localhost" ,
255- "ports" : {
256- "auth" : 9099 ,
257- "firestore" : 8080 ,
258- "functions" : 5001 ,
259- "hosting" : 5002
260- }
261- }
262- }
263- ```
282+ Update the emulator setting to ` true ` in the ` src/config.json ` to switch the application to use local emulators.
264283
265284Start emulators:
266285``` bash
267286firebase emulators:start
268287```
269288
289+ ## Firebase Deployment
290+
291+ 4 . Build and deploy:
292+ ``` bash
293+ npm run build
294+ firebase deploy
295+ ```
296+
297+ Your app will be available at:
298+ - https://your-project-id.web.app
299+ - https://your-project-id.firebaseapp.com
300+
270301## Next Steps
271302
272303- Configure social login providers
0 commit comments