├── .github └── FUNDING.yml ├── .gitignore ├── README.md ├── layouts └── default.vue ├── nuxt.config.js ├── package-lock.json ├── package.json ├── pages └── index.vue └── plugins └── firebase.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Enables "Sponsor" button on project 2 | 3 | github: lupas 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .nuxt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt.js (v2), Firestore & SSR 🔥 2 | 3 | Nuxt.js (v2) & Firestore integration with working SSR. 4 | 5 | ## Step-by-step Guide 6 | 7 | https://medium.com/@pascalluther/nuxt-js-v2-firestore-ssr-938d8fb7d2b0 8 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | const pkg = require('./package') 2 | 3 | module.exports = { 4 | mode: 'universal', 5 | head: { 6 | title: pkg.name, 7 | meta: [ 8 | { charset: 'utf-8' }, 9 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 10 | { hid: 'description', name: 'description', content: pkg.description } 11 | ] 12 | }, 13 | plugins: ['~/plugins/firebase.js'] 14 | } 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt2-firestore", 3 | "version": "1.0.0", 4 | "description": "My ultimate Nuxt.js project", 5 | "author": "Pascal", 6 | "private": true, 7 | "scripts": { 8 | "dev": "nuxt", 9 | "build": "nuxt build", 10 | "start": "nuxt start", 11 | "generate": "nuxt generate" 12 | }, 13 | "dependencies": { 14 | "core-js": "^2.6.11", 15 | "cross-env": "^7.0.2", 16 | "firebase": "^7.10.0", 17 | "nuxt": "^2.11.0" 18 | }, 19 | "devDependencies": { 20 | "nodemon": "^1.11.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 82 | 83 | 92 | -------------------------------------------------------------------------------- /plugins/firebase.js: -------------------------------------------------------------------------------- 1 | import firebase from 'firebase/app' 2 | import 'firebase/firestore' 3 | 4 | if (!firebase.apps.length) { 5 | const config = { 6 | apiKey: '', 7 | authDomain: '', 8 | databaseURL: '', 9 | projectId: '', 10 | storageBucket: '', 11 | messagingSenderId: '', 12 | appId: '', 13 | measurementId: '', 14 | fcmPublicVapidKey: '' 15 | } 16 | firebase.initializeApp(config) 17 | firebase.firestore() 18 | } 19 | const fireDb = firebase.firestore() 20 | export { fireDb } 21 | --------------------------------------------------------------------------------