DEMO: https://snsc-b7bc3.web.app/
Before getting started, ensure you have the following prerequisites:
Use this template
button.cd nextjs-13-firebase-starter
npm install
# or
yarn install
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This project uses next/font
to automatically optimize and load Inter, a custom Google Font.
To learn more about Next.js, take a look at the following resources:
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.
https://console.firebase.google.com/
Go to console
button.Add Project
card.Continue
button.Google Analytics for this project
(unless you wish to use it).Create project
button.Web
.Register app
button.npm i firebase
.src
called firebase
called firebase.js
..env
..env.local
to your .gitignore
so you don't expose your variables in git repo.Example...
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
env
file and paste these variables with your own information.Continue on console
buttonAuthentication
.Get started with Firebase Auth by adding your first sign-in method
select Email/Password
.You should now be setup to use Firebase.
src/firebase
directory, exists the directory auth
containing the logic for signin
and signup
.The folder structure of this project is organized as follows:
pages
: Contains the Next.js pages for server-side rendering.components
: Holds the reusable React components.lib
: Includes utility functions and modules.public
: Stores static assets such as images, fonts, and stylesheets.styles
: Contains global styles and Tailwind CSS configuration.firebase
: Houses the Firebase configuration and Firebase-related functions.Feel free to modify and expand the folder structure according to your project requirements.
To deploy your Next.js application with Firebase, follow the Firebase deployment instructions specific to your hosting option (Firebase Hosting, Cloud Functions, etc.). Make sure to set up the appropriate environment variables for your production environment.
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
This project was created using the Next.js framework and Firebase platform.
Resources