Full Starter Code for Next.js and Firebase 👤 next-firebase-auth
+ 🗃 Firestore + 🔔 Messaging.
- Firebase Authentication Setup
- Private and Login Pages
- Automatically set new users in
users
collection - Firebase Client and Admin SDK Init
- Clean Project Structure (Functions, references for Firestore)
- SSR / SSG via Firestore Data
- Enable Firebase Cloud Messaging
- FCM Service Worker Setup
- Tailwind CSS
- Module path aliases
Install dependencies npm install
-
Refer
.env.local.example
and rename after adding your own variables. -
Refer
pages/dashboard.js
for private page (Authentication Required). Andpages/login.js
for login page. -
Refer
components/elements/firebaseAuth.js
file to add more Providers. -
Use Admin SDK's Firestore Functions: utils/firebase/firestore/fsAdminFunctions.js for server operations.
Note: Do not use these for Client Side.
-
Refer jsconfig.json
-
Refer firebase-messaging-sw.js
next-firebase-auth
library documentation (Great Library ♥)- Firebase Official Documentation
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!