├── .babelrc ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── LICENSE.md ├── README.md ├── assets ├── README.md ├── css │ └── main.css └── nuxt-logo.svg ├── components ├── FireStoreTest.vue ├── FirebaseUI.vue ├── Footer.vue ├── Header.vue └── README.md ├── firebase.config.js.template ├── firebase.json ├── functions ├── .gitignore ├── package-lock.json ├── package.json ├── src │ └── index.ts ├── tsconfig.json └── tslint.json ├── jest.config.js ├── layouts ├── README.md └── default.vue ├── middleware ├── README.md └── router-auth.js ├── nuxt.config.js ├── package.json ├── pages ├── README.md ├── about.vue ├── app │ └── index.vue ├── index.vue └── login.vue ├── plugins ├── README.md ├── fireauth.js └── firebase.js ├── server └── index.js ├── static ├── README.md └── favicon.ico ├── store ├── README.md └── index.js └── test └── Footer.spec.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "test": { 4 | "presets": [ 5 | [ 6 | "@babel/preset-env", 7 | { 8 | "targets": { 9 | "node": "current" 10 | } 11 | } 12 | ] 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true 6 | }, 7 | parserOptions: { 8 | parser: 'babel-eslint' 9 | }, 10 | extends: [ 11 | '@nuxtjs', 12 | 'plugin:nuxt/recommended', 13 | 'plugin:prettier/recommended', 14 | 'prettier', 15 | 'prettier/vue' 16 | ], 17 | plugins: [ 18 | 'prettier' 19 | ], 20 | // add your custom rules here 21 | rules: { 22 | 'nuxt/no-cjs-in-config': 'off' 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (https://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | node_modules/ 39 | jspm_packages/ 40 | 41 | # TypeScript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | 62 | # parcel-bundler cache (https://parceljs.org/) 63 | .cache 64 | 65 | # next.js build output 66 | .next 67 | 68 | # nuxt.js build output 69 | .nuxt 70 | 71 | # Nuxt generate 72 | dist 73 | 74 | # vuepress build output 75 | .vuepress/dist 76 | 77 | # Serverless directories 78 | .serverless 79 | 80 | # IDE 81 | .idea 82 | 83 | # Service worker 84 | sw.* 85 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2019 Nils Wöhler 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt FirebaseUI starter 2 | 3 | > Starter repository for NuxtJS with FirebaseUI 4 | 5 | ## Configure firebase 6 | 7 | Copy `firebase.config.js.template` to `firebase.config.js` and enter firebase application configuration details. 8 | 9 | ## Build Setup 10 | 11 | ``` bash 12 | # install dependencies 13 | $ npm install 14 | 15 | # serve with hot reload at localhost:3000 16 | $ npm run dev 17 | 18 | # build for production and launch server 19 | $ npm run build 20 | $ npm start 21 | 22 | # generate static project 23 | $ npm run generate 24 | ``` 25 | 26 | For detailed explanation on how things work, checkout [Nuxt.js docs](https://nuxtjs.org). 27 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # ASSETS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). 8 | -------------------------------------------------------------------------------- /assets/css/main.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ncwoehler/nuxt-firebaseui-starter/104cb8a22c722d76c569b02b34c238a36f9bba6b/assets/css/main.css -------------------------------------------------------------------------------- /assets/nuxt-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /components/FireStoreTest.vue: -------------------------------------------------------------------------------- 1 | 28 | 65 | -------------------------------------------------------------------------------- /components/FirebaseUI.vue: -------------------------------------------------------------------------------- 1 | 6 | 50 | 51 | -------------------------------------------------------------------------------- /components/Footer.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /components/Header.vue: -------------------------------------------------------------------------------- 1 | 38 | 53 | 83 | -------------------------------------------------------------------------------- /components/README.md: -------------------------------------------------------------------------------- 1 | # COMPONENTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | The components directory contains your Vue.js Components. 6 | 7 | _Nuxt.js doesn't supercharge these components._ 8 | -------------------------------------------------------------------------------- /firebase.config.js.template: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | apiKey: '', 3 | authDomain: '', 4 | databaseURL: '', 5 | projectId: '', 6 | storageBucket: '', 7 | messagingSenderId: '', 8 | appId: '' 9 | } 10 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "source": "functions", 4 | "predeploy": [ 5 | "npm run build && rm -rf functions/nuxt && cp -r .nuxt/ functions/nuxt/ && cp nuxt.config.js functions/" 6 | ] 7 | }, 8 | "hosting": { 9 | "predeploy": [ 10 | "rm -rf public/* && mkdir -p public/_nuxt && cp -r .nuxt/dist/client/ public/_nuxt && cp -a static/. public/" 11 | ], 12 | "public": "public", 13 | "ignore": [ 14 | "firebase.json", 15 | "**/.*", 16 | "**/node_modules/**" 17 | ], 18 | "rewrites": [ 19 | { 20 | "source": "**", 21 | "function": "nuxtApp" 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /functions/.gitignore: -------------------------------------------------------------------------------- 1 | ## Compiled JavaScript files 2 | **/*.js 3 | **/*.js.map 4 | 5 | # Typescript v1 declaration files 6 | typings/ 7 | 8 | node_modules/ -------------------------------------------------------------------------------- /functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "lint": "tslint --project tsconfig.json", 5 | "build": "tsc", 6 | "serve": "npm run build && firebase serve --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "8" 14 | }, 15 | "main": "lib/index.js", 16 | "dependencies": { 17 | "firebase-admin": "~7.0.0", 18 | "firebase-functions": "^2.3.0", 19 | "@nuxtjs/pwa": "^2.6.0", 20 | "bootstrap": "^4.1.3", 21 | "bootstrap-vue": "^2.0.0-rc.11", 22 | "cross-env": "^5.2.0", 23 | "dotprop": "^1.2.0", 24 | "express": "^4.16.4", 25 | "firebase": "^6.0.4", 26 | "firebaseui": "^4.0.0", 27 | "nuxt": "^2.6.2", 28 | "nuxt-svg-loader": "^1.0.1" 29 | }, 30 | "devDependencies": { 31 | "tslint": "^5.12.0", 32 | "typescript": "^3.2.2", 33 | "babel-eslint": "^10.0.1", 34 | "eslint": "^5.3.0", 35 | "eslint-plugin-import": "^2.14.0" 36 | }, 37 | "private": true 38 | } 39 | -------------------------------------------------------------------------------- /functions/src/index.ts: -------------------------------------------------------------------------------- 1 | // from: https://medium.com/likecoin/quick-nuxt-js-ssr-prototyping-with-firebase-cloud-functions-5277553610a8 2 | const functions = require('firebase-functions') 3 | const { Nuxt } = require('nuxt-start') 4 | 5 | const nuxtConfig = require('./nuxt.config.js') 6 | 7 | const config = { 8 | ...nuxtConfig, 9 | dev: false, 10 | debug: false, 11 | buildDir: 'nuxt' 12 | } 13 | const nuxt = new Nuxt(config) 14 | 15 | exports.nuxtApp = functions.https.onRequest((req: any, res: any) => 16 | nuxt.render(req, res) 17 | ) 18 | -------------------------------------------------------------------------------- /functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017" 10 | }, 11 | "compileOnSave": true, 12 | "include": [ 13 | "src" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /functions/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | // -- Strict errors -- 4 | // These lint rules are likely always a good idea. 5 | 6 | // Force function overloads to be declared together. This ensures readers understand APIs. 7 | "adjacent-overload-signatures": true, 8 | 9 | // Do not allow the subtle/obscure comma operator. 10 | "ban-comma-operator": true, 11 | 12 | // Do not allow internal modules or namespaces . These are deprecated in favor of ES6 modules. 13 | "no-namespace": true, 14 | 15 | // Do not allow parameters to be reassigned. To avoid bugs, developers should instead assign new values to new vars. 16 | "no-parameter-reassignment": true, 17 | 18 | // Force the use of ES6-style imports instead of /// imports. 19 | "no-reference": true, 20 | 21 | // Do not allow type assertions that do nothing. This is a big warning that the developer may not understand the 22 | // code currently being edited (they may be incorrectly handling a different type case that does not exist). 23 | "no-unnecessary-type-assertion": true, 24 | 25 | // Disallow nonsensical label usage. 26 | "label-position": true, 27 | 28 | // Disallows the (often typo) syntax if (var1 = var2). Replace with if (var2) { var1 = var2 }. 29 | "no-conditional-assignment": true, 30 | 31 | // Disallows constructors for primitive types (e.g. new Number('123'), though Number('123') is still allowed). 32 | "no-construct": true, 33 | 34 | // Do not allow super() to be called twice in a constructor. 35 | "no-duplicate-super": true, 36 | 37 | // Do not allow the same case to appear more than once in a switch block. 38 | "no-duplicate-switch-case": true, 39 | 40 | // Do not allow a variable to be declared more than once in the same block. Consider function parameters in this 41 | // rule. 42 | "no-duplicate-variable": [true, "check-parameters"], 43 | 44 | // Disallows a variable definition in an inner scope from shadowing a variable in an outer scope. Developers should 45 | // instead use a separate variable name. 46 | "no-shadowed-variable": true, 47 | 48 | // Empty blocks are almost never needed. Allow the one general exception: empty catch blocks. 49 | "no-empty": [true, "allow-empty-catch"], 50 | 51 | // Functions must either be handled directly (e.g. with a catch() handler) or returned to another function. 52 | // This is a major source of errors in Cloud Functions and the team strongly recommends leaving this rule on. 53 | "no-floating-promises": true, 54 | 55 | // Do not allow any imports for modules that are not in package.json. These will almost certainly fail when 56 | // deployed. 57 | "no-implicit-dependencies": true, 58 | 59 | // The 'this' keyword can only be used inside of classes. 60 | "no-invalid-this": true, 61 | 62 | // Do not allow strings to be thrown because they will not include stack traces. Throw Errors instead. 63 | "no-string-throw": true, 64 | 65 | // Disallow control flow statements, such as return, continue, break, and throw in finally blocks. 66 | "no-unsafe-finally": true, 67 | 68 | // Do not allow variables to be used before they are declared. 69 | "no-use-before-declare": true, 70 | 71 | // Expressions must always return a value. Avoids common errors like const myValue = functionReturningVoid(); 72 | "no-void-expression": [true, "ignore-arrow-function-shorthand"], 73 | 74 | // Disallow duplicate imports in the same file. 75 | "no-duplicate-imports": true, 76 | 77 | 78 | // -- Strong Warnings -- 79 | // These rules should almost never be needed, but may be included due to legacy code. 80 | // They are left as a warning to avoid frustration with blocked deploys when the developer 81 | // understand the warning and wants to deploy anyway. 82 | 83 | // Warn when an empty interface is defined. These are generally not useful. 84 | "no-empty-interface": {"severity": "warning"}, 85 | 86 | // Warn when an import will have side effects. 87 | "no-import-side-effect": {"severity": "warning"}, 88 | 89 | // Warn when variables are defined with var. Var has subtle meaning that can lead to bugs. Strongly prefer const for 90 | // most values and let for values that will change. 91 | "no-var-keyword": {"severity": "warning"}, 92 | 93 | // Prefer === and !== over == and !=. The latter operators support overloads that are often accidental. 94 | "triple-equals": {"severity": "warning"}, 95 | 96 | // Warn when using deprecated APIs. 97 | "deprecation": {"severity": "warning"}, 98 | 99 | // -- Light Warnings -- 100 | // These rules are intended to help developers use better style. Simpler code has fewer bugs. These would be "info" 101 | // if TSLint supported such a level. 102 | 103 | // prefer for( ... of ... ) to an index loop when the index is only used to fetch an object from an array. 104 | // (Even better: check out utils like .map if transforming an array!) 105 | "prefer-for-of": {"severity": "warning"}, 106 | 107 | // Warns if function overloads could be unified into a single function with optional or rest parameters. 108 | "unified-signatures": {"severity": "warning"}, 109 | 110 | // Prefer const for values that will not change. This better documents code. 111 | "prefer-const": {"severity": "warning"}, 112 | 113 | // Multi-line object literals and function calls should have a trailing comma. This helps avoid merge conflicts. 114 | "trailing-comma": {"severity": "warning"} 115 | }, 116 | 117 | "defaultSeverity": "error" 118 | } 119 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleNameMapper: { 3 | '^@/(.*)$': '/$1', 4 | '^~/(.*)$': '/$1', 5 | '^vue$': 'vue/dist/vue.common.js' 6 | }, 7 | moduleFileExtensions: ['js', 'vue', 'json'], 8 | transform: { 9 | '^.+\\.js$': 'babel-jest', 10 | '.*\\.(vue)$': 'vue-jest' 11 | }, 12 | collectCoverage: true, 13 | collectCoverageFrom: [ 14 | '/components/**/*.vue', 15 | '/pages/**/*.vue' 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Application Layouts. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). 8 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 10 | 23 | 34 | -------------------------------------------------------------------------------- /middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your application middleware. 6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages. 7 | 8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). 9 | -------------------------------------------------------------------------------- /middleware/router-auth.js: -------------------------------------------------------------------------------- 1 | export default function({ store, redirect, route }) { 2 | if (store.state.user != null && route.name === 'login') { 3 | redirect('/app') 4 | } 5 | if (store.state.user == null && isSecureRoute(route)) { 6 | redirect('/login') 7 | } 8 | } 9 | 10 | function isSecureRoute(route) { 11 | if (route.matched.some(record => record.path === '/app')) { 12 | return true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | const pkg = require('./package') 2 | 3 | module.exports = { 4 | mode: 'universal', 5 | 6 | /* 7 | ** Headers of the page 8 | */ 9 | head: { 10 | title: 'nuxt-firebaseui-starter', 11 | meta: [ 12 | { charset: 'utf-8' }, 13 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 14 | { hid: 'description', name: 'description', content: pkg.description } 15 | ], 16 | link: [{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }] 17 | }, 18 | 19 | /* 20 | ** Customize the progress-bar color 21 | */ 22 | loading: { color: '#fff' }, 23 | 24 | /* 25 | ** Global CSS 26 | */ 27 | css: [{ src: '~/assets/css/main.css', lang: 'css' }], 28 | 29 | /* 30 | ** Plugins to load before mounting the App 31 | */ 32 | plugins: ['~/plugins/fireauth.js'], 33 | 34 | /* 35 | ** Nuxt.js modules 36 | */ 37 | modules: [ 38 | // Doc: https://bootstrap-vue.js.org/docs/ 39 | 'bootstrap-vue/nuxt', 40 | '@nuxtjs/pwa', 41 | 'nuxt-svg-loader' 42 | ], 43 | router: { 44 | middleware: 'router-auth' 45 | }, 46 | /* 47 | ** Build configuration 48 | */ 49 | build: { 50 | extractCSS: true, 51 | /* 52 | ** You can extend webpack config here 53 | */ 54 | extend(config, ctx) { 55 | // Run ESLint on save 56 | if (ctx.isDev && ctx.isClient) { 57 | config.module.rules.push({ 58 | enforce: 'pre', 59 | test: /\.(js|vue)$/, 60 | loader: 'eslint-loader', 61 | exclude: /(node_modules)/ 62 | }) 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-firebaseui-starter", 3 | "version": "1.0.0", 4 | "description": "My wicked Nuxt.js project", 5 | "author": "Nils Wöhler", 6 | "private": true, 7 | "scripts": { 8 | "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", 9 | "build": "nuxt build", 10 | "start": "cross-env NODE_ENV=production node server/index.js", 11 | "generate": "nuxt generate", 12 | "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", 13 | "precommit": "npm run lint", 14 | "test": "jest" 15 | }, 16 | "dependencies": { 17 | "@nuxtjs/pwa": "^2.6.0", 18 | "bootstrap": "^4.5.3", 19 | "bootstrap-vue": "^2.18.0", 20 | "cross-env": "^5.2.1", 21 | "dotprop": "^1.2.0", 22 | "express": "^4.17.1", 23 | "firebase": "^6.6.2", 24 | "firebaseui": "^4.7.0", 25 | "nuxt": "^2.14.7", 26 | "nuxt-svg-loader": "^1.2.0" 27 | }, 28 | "devDependencies": { 29 | "@nuxtjs/eslint-config": "^0.0.1", 30 | "@vue/test-utils": "^1.1.0", 31 | "babel-core": "7.0.0-bridge.0", 32 | "babel-eslint": "^10.1.0", 33 | "babel-jest": "^24.9.0", 34 | "eslint": "^5.15.1", 35 | "eslint-config-prettier": "^4.1.0", 36 | "eslint-config-standard": "^14.1.1", 37 | "eslint-loader": "^2.2.1", 38 | "eslint-plugin-import": "^2.22.1", 39 | "eslint-plugin-jest": "^23.20.0", 40 | "eslint-plugin-node": "^10.0.0", 41 | "eslint-plugin-nuxt": "^0.5.2", 42 | "eslint-plugin-prettier": "^3.1.4", 43 | "eslint-plugin-promise": "^4.2.1", 44 | "eslint-plugin-standard": "^4.0.1", 45 | "eslint-plugin-vue": "^5.2.3", 46 | "jest": "^24.9.0", 47 | "nodemon": "^1.19.4", 48 | "prettier": "^1.19.1", 49 | "vue-jest": "^3.0.7" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pages/README.md: -------------------------------------------------------------------------------- 1 | # PAGES 2 | 3 | This directory contains your Application Views and Routes. 4 | The framework reads all the `*.vue` files inside this directory and creates the router of your application. 5 | 6 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing). 7 | -------------------------------------------------------------------------------- /pages/about.vue: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /pages/app/index.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 18 | 24 | 40 | -------------------------------------------------------------------------------- /pages/login.vue: -------------------------------------------------------------------------------- 1 | 8 | 13 | 23 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). 8 | -------------------------------------------------------------------------------- /plugins/fireauth.js: -------------------------------------------------------------------------------- 1 | import { fireAuth } from '@/plugins/firebase.js' 2 | 3 | export default context => { 4 | const { store } = context 5 | 6 | return new Promise((resolve, reject) => { 7 | fireAuth.onAuthStateChanged(user => { 8 | store.commit('setUser', user) 9 | resolve() 10 | }) 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /plugins/firebase.js: -------------------------------------------------------------------------------- 1 | import firebase from 'firebase/app' 2 | import firebaseConf from '~/firebase.config.js' 3 | import 'firebase/firestore' 4 | import 'firebase/auth' 5 | 6 | if (!firebase.apps.length) { 7 | firebase.initializeApp(firebaseConf) 8 | } 9 | 10 | export const authProviders = { 11 | Google: firebase.auth.GoogleAuthProvider.PROVIDER_ID, 12 | Email: firebase.auth.EmailAuthProvider.PROVIDER_ID 13 | } 14 | export const fireDb = firebase.firestore() 15 | export const fireAuth = firebase.auth() 16 | -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const consola = require('consola') 3 | const { Nuxt, Builder } = require('nuxt') 4 | const app = express() 5 | 6 | // Import and Set Nuxt.js options 7 | const config = require('../nuxt.config.js') 8 | config.dev = !(process.env.NODE_ENV === 'production') 9 | 10 | async function start() { 11 | // Init Nuxt.js 12 | const nuxt = new Nuxt(config) 13 | 14 | const { host, port } = nuxt.options.server 15 | 16 | // Build only in dev mode 17 | if (config.dev) { 18 | const builder = new Builder(nuxt) 19 | await builder.build() 20 | } else { 21 | await nuxt.ready() 22 | } 23 | 24 | // Give nuxt middleware to express 25 | app.use(nuxt.render) 26 | 27 | // Listen the server 28 | app.listen(port, host) 29 | consola.ready({ 30 | message: `Server listening on http://${host}:${port}`, 31 | badge: true 32 | }) 33 | } 34 | start() 35 | -------------------------------------------------------------------------------- /static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your static files. 6 | Each file inside this directory is mapped to `/`. 7 | Thus you'd want to delete this README.md before deploying to production. 8 | 9 | Example: `/static/robots.txt` is mapped as `/robots.txt`. 10 | 11 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). 12 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ncwoehler/nuxt-firebaseui-starter/104cb8a22c722d76c569b02b34c238a36f9bba6b/static/favicon.ico -------------------------------------------------------------------------------- /store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Vuex Store files. 6 | Vuex Store option is implemented in the Nuxt.js framework. 7 | 8 | Creating a file in this directory automatically activates the option in the framework. 9 | 10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). 11 | -------------------------------------------------------------------------------- /store/index.js: -------------------------------------------------------------------------------- 1 | import { fireAuth } from '@/plugins/firebase.js' 2 | 3 | export const strict = false 4 | 5 | export const state = () => ({ 6 | user: null 7 | }) 8 | 9 | export const mutations = { 10 | setUser(state, payload) { 11 | state.user = payload 12 | } 13 | } 14 | 15 | export const actions = { 16 | signOut({ commit }) { 17 | fireAuth 18 | .signOut() 19 | .then(() => { 20 | commit('setUser', null) 21 | }) 22 | .catch(err => alert(err)) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Footer.spec.js: -------------------------------------------------------------------------------- 1 | import { mount } from '@vue/test-utils' 2 | import Logo from '@/components/Footer.vue' 3 | 4 | describe('Footer', () => { 5 | test('is a Vue instance', () => { 6 | const wrapper = mount(Logo) 7 | expect(wrapper.isVueInstance()).toBeTruthy() 8 | }) 9 | }) 10 | --------------------------------------------------------------------------------