Firebase Next.js Example
A simple example of how to connect to a Firebase database and retrieve data.
Installation
- Install Node dependencies:
# with NPM
npm install
# with Yarn
yarn- Create a
.envfile and a.env.productionfile in the project root with the following structure:
FIREBASE_API_KEY=ASndKBULjahs57AdnaiAasd2asKD234HBJKHasd
FIREBASE_AUTH_DOMAIN=my-app.firebaseapp.com
FIREBASE_DATABASE_URL=https://my-app.firebaseio.com
FIREBASE_PROJECT_ID=my-app
FIREBASE_STORAGE_BUCKET=my-app.appspot.com
FIREBASE_SENDER_ID=987678767878
- Run the app:
# with NPM
npm run dev
# with Yarn
yarn dev