rsnext/examples/with-firebase
2020-06-08 01:03:38 +00:00
..
context fix typo in comment (#13883) 2020-06-08 01:03:38 +00:00
firebase With Firebase Client-Side example (#11053) 2020-03-20 15:38:28 -05:00
pages Update Examples for Fast Refresh (#13068) 2020-05-18 17:44:18 -04:00
public Rename ZEIT to Vercel (#12075) 2020-04-21 11:47:12 +02:00
.env.example With Firebase Client-Side example (#11053) 2020-03-20 15:38:28 -05:00
next.config.js With Firebase Client-Side example (#11053) 2020-03-20 15:38:28 -05:00
package.json With Firebase Client-Side example (#11053) 2020-03-20 15:38:28 -05:00
README.md Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
vercel.json Update instances of Now to Vercel where applicable (#13760) 2020-06-04 14:57:17 +00:00

With Firebase

This is a simple set up for Firebase for client side applications.

The firebase app is initialized in firebase/clientApp.js, to use you just have to import it anywhere in the app

The React Context API is used to provide user state.

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

Using create-next-app

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example with-firebase with-firebase-app
# or
yarn create next-app --example with-firebase with-firebase-app

Download manually

Download the example:

curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-firebase
cd with-firebase

Configuration

  1. Create a Firebase project and add a new app to it.
  2. Create a .env file and copy the contents of .env.example into it:
cp .env.example .env
  1. Set each variable on .env with your Firebase Configuration (found in "Project settings").

Install it and run:

npm install
npm run dev
# or
yarn
yarn dev

Deploy it to the cloud with Vercel (Documentation).