The ultimate learning resource for Vue developers
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
# install dependencies
$ npm install # Or yarn install
We need to install firebase tools to deploy.
$ npm install -g firebase-tools
Because we don't want to share Firebase credential we need to create a firebase.js
file in the root of the project. It will look something like this:
module.exports = {
'apiKey': 'info-from-firebase-web-instructions',
'authDomain': 'info-from-firebase-web-instructions',
'databaseURL': 'info-from-firebase-web-instructions',
'projectId': 'info-from-firebase-web-instructions',
'storageBucket': 'info-from-firebase-web-instructions',
'messagingSenderId': 'info-from-firebase-web-instructions'
}
To use MailerLite, SparkPost, and stripe we need to configure enviroment keys using this command:
$ firebase functions:config:set mailerlite.key="THE KEY"
$ firebase functions:config:set sparkpost.key="THE KEY"
$ firebase functions:config:set stripe.token="THE KEY"
To list the current config:
$ functions:config:get
In order to keep other users from writing to paths they don't own, we need to add some rules to the database:
{
"rules": {
"accounts": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
We will setup social login for Google and Github. We will need to login to your Firebase console and enable those signin methods. Google will work out-of-the-box with any Firebase app. But we will need to create a new oAuth application if we would like to use Github signin.
We use Cypress to test
$(npm bin)/cypress open
# serve with hot reloading at localhost:3000
$ npm run dev
Go to http://localhost:3000
This is just in case we want to deploy on differrent server then firebase hosting
# build for production and launch the server
$ npm run build
$ npm start
# generate a static project
$ npm run generate
You should probably generate the static porject before you deploy as the deployment take every static output from nuxt to the dist folder, which is then copy over to firebase host folder. The functions folder is also copy over and help us to repsond to specific backend tasks.
# deploy solution to firebase
$ firebase deploy