npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

firebase-nextjs

v1.7.5

Published

Connect Next.js with Firebase Authentication.

Downloads

356

Readme

firebase-nextjs

Effortless Firebase integration for NextJS

Demo : https://firebase-nextjs.scaria.dev

Setup Instructions

The setup will automatically take care of configurations and credentials. If you would instead prefer to do it all manually, Click here.

Prerequisite: A firebase project.

1. Install the package

npm install firebase-nextjs

2. Run the setup script

npx firebase-nextjs setup

This will

  • Prompt you to log in with Google.
  • You will be asked to select the firebase project you wish to use.
  • You will be asked to choose the service account you wish to use. ("firebase-admin-sdk" is recommended)
  • Choose an app you wish to use. (Must be a web app) (If an app doesn't exist, you can create it there.)
  • This will generate the necessary authentication credentials, and store it to the project.
  • With this, basic setup is complete.

3. Setup firebase-nextjs Provider

In the root layout file, (layout.jsx), wrap the whole body in <FirebaseNextJSProvider>

import {FirebaseNextJSProvider} from "firebase-nextjs/client/auth";


<html lang="en">
    <FirebaseNextJSProvider>
        <body className={inter.className}>{children}</body>
    </FirebaseNextJSProvider>
</html>

4. Thats it! Run the project.

npm run dev

This will require you to sign in to continue. You can use Google Sign In or Email Password Sign In.

Access the auth state

You can access the authentication state, and the user object on client side as well as server side easily. Learn more: https://firebase-nextjs.scaria.dev/auth

Customisation

firebase-nextjs offers complete customisation of login pages. To learn more, visit: https://firebase-nextjs.scaria.dev/custom_login

Components

firebase-nextjs comes with many pre built components to help with user authentication and user management. Learn more from: https://firebase-nextjs.scaria.dev/components

Routing

You can customise the rules for routing, and define which pages are public and which pages are for logged in users. Learn more at: https://firebase-nextjs.scaria.dev/routing

Moving to production

Before deploying the app to production, there are few configurations and security measures to be done. Read more at: https://firebase-nextjs.scaria.dev/production

For Developers

If you wish to contribute or make changes to the package, follow the below guide

Step 1: Fork and clone the repo

Fork the repo to your profile and clone the repo locally.

Step 2: Build the package

Run the command

npm run build

This will create a folder 'build' in the directory. It will contain the actual package that you should be using.

Step 3: Link the package to your project

Create a nextjs project that you wish to test the package with. (Or use your existing NextJS project). Copy the location of the build directory generated from the previous step.

Run the command

npx link /path/to/build/folder/of/firebase-nextjs

Step 4: Use the package

Now, the package is linked to your project, and it is exactly as if you have installed the package. Do not add the package name to package.json.

To use the package in your project, You can import the files just like you would form an installed package.

Example:

import { ProfileButton } from "firebase-nextjs/client/components";

To use the npx script You can run the npx script as usual, and the code in your build folder will be used.

npx firebase-nextjs getenev

Step 5: Modifications

After you make any modification to the source code, run

npm run build

Thats it and your project will be using the newly built package.

NOTE: Installing other packages

Whenever you use the command npm install packagename to install any package, the npx link will be removed. Re run the npx command to link to the build directory again.

Contributing

If you have done any modification that might be useful to others, you are welcome to create a pull request and become a contributor.