Firebase

Manage Users
with Firebase.

Add secure authentication to your project. Learn how to set up Firebase Auth to manage user profiles, save game progress, and protect premium features.

  Expert Difficulty   ~20 min setup   Updated 2026
Secure. Scalable. Simple.
On this page
01

Firebase Console Setup

Firebase is a Google-backed platform that provides backend-as-a-service. For NetDocs, we use their Authentication module.

1

Create Project

Go to the Firebase Console and click Add Project. Give it a name and click through the setup.

2

Enable Auth

In the sidebar, go to AuthenticationGet Started. Enable the Email/Password and Google sign-in methods.

3

Register Web App

Click the </> icon in your project overview to register a web app. Copy the firebaseConfig object — you'll need it later.


02

SDK Integration

Include the Firebase SDK in your project. We'll use the modular v9+ syntax for better performance.

firebase-config.js
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-app.js";
import { getAuth } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-auth.js";

const firebaseConfig = {
  apiKey: "YOUR_API_KEY",
  authDomain: "YOUR_PROJECT.firebaseapp.com",
  projectId: "YOUR_PROJECT_ID",
  // ... other config values
};

const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);

03

Authentication Logic

Creating a simple sign-up function using Email and Password.

auth.js
import { createUserWithEmailAndPassword } from "...";

export const signUp = (email, password) => {
  createUserWithEmailAndPassword(auth, email, password)
    .then((userCredential) => {
      const user = userCredential.user;
      console.log("User signed up:", user);
    })
    .catch((error) => {
      console.error("Error signing up:", error.message);
    });
};

04

Handling User State

Use the onAuthStateChanged listener to detect when a user logs in or out and update your UI accordingly.

Persistence Firebase automatically handles session persistence. When a user refreshes the page, they will remain logged in until they explicitly click "Log Out".