Skip to content

Commit 05493e2

Browse files
committed
docs: update setup and links
1 parent b7fcaf0 commit 05493e2

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

docs/cookbook/nuxt.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Nuxt.js
2+
3+
WIP

docs/guide/auth.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Firebase Authentication
2+
3+
WIP

docs/guide/getting-started.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ VueFire requires Firebase JS SDK >= 9 but **is compatible with Vue 2 and Vue 3**
2020

2121
## Usage
2222

23-
VueFire expects you to use the existing APIs from Firebase as much as possible. It doesn't expose any configs to initialize your app or get the database/firestore instances. You should follow the official Firebase documentation for that. We do have [some recommendations](#TODO) for a Vue project and [a Nuxt module](#TODO) to help you get started.
23+
VueFire expects you to use the existing APIs from Firebase as much as possible. It doesn't expose any configs to initialize your app or get the database/firestore instances. You should follow the official Firebase documentation for that. We do have [some recommendations](#TODO) for a Vue project and [a Nuxt module](../cookbook/nuxt.md) to help you get started.
2424

2525
Most of the time, you should gather collection references in one of your files and export them but **to keep examples short, we will always create the database references whenever necessary** instead of gathering them in one place. We will also consider that we have access to some globals (you usually import them from the file where you initialize your Firebase app):
2626

@@ -30,7 +30,7 @@ import { getFirestore } from 'firebase/firestore'
3030
import { getDatabase } from 'firebase/database'
3131
// ... other firebase imports
3232

33-
export const firebase = initializeApp({
33+
export const firebaseApp = initializeApp({
3434
// your application settings
3535
})
3636
export const database = getFirestore(firebase)
@@ -42,6 +42,31 @@ export const firestore = getDataBase(firebase)
4242
Note that we will refer to `database` and `firestore` as `db` in examples where only one of them is used.
4343
:::
4444

45+
### Setup
46+
47+
First, install the VueFire Vue plugin. It will allow you to add extra modules like [Storage](./storage.md) or [Auth](./auth.md) to your app.
48+
49+
```ts
50+
import { createApp } from 'vue'
51+
import { VueFire, VueFireAuth } from 'vuefire'
52+
import App from './App.vue'
53+
// the file we created above with `database`, `firestore` and other exports
54+
import { firebaseApp } from './firebase'
55+
56+
const app = createApp(App)
57+
app
58+
.use(VueFire, {
59+
// imported above but could also just be created here
60+
firebaseApp,
61+
modules: [
62+
// we will see other modules later on
63+
VueFireAuth(),
64+
],
65+
})
66+
67+
app.mount('#app')
68+
```
69+
4570
### Composition API
4671

4772
VueFire exposes a few [composables](https://vuejs.org/guide/reusability/composables.html#composables) to create reactive variables from Firebase references.

docs/guide/storage.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Firebase Storage
2+
3+
WIP

playground/src/main.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ const store = createStore({
2020
}),
2121
})
2222

23-
// @ts-expect-error: ok
24-
self.FIREBASE_APPCHECK_DEBUG_TOKEN = true
25-
2623
const app = createApp(App)
2724
app
2825
.use(createPinia())
@@ -31,9 +28,10 @@ app
3128
modules: [
3229
VueFireAuth(),
3330
VueFireAppCheck({
31+
debug: process.env.NODE_ENV !== 'production',
3432
isTokenAutoRefreshEnabled: true,
3533
provider: new ReCaptchaV3Provider(
36-
'6LfJ0vgiAAAAAHheQE7GQVdG_c9m8xipBESx_SKI'
34+
'6LfJ0vgiAAAAAHheQE7GQVdG_c9m8xipBESx_SKI',
3735
),
3836
}),
3937
],

0 commit comments

Comments
 (0)