A minimal Node.js CLI tool for Firebase that seeds the first administrator user and manages custom claims (roles) for fine-grained access control.
Find a file
Guillaume "B.B." Van Hemmen 7dfd287464 #0000 - Simplify to local CLI, expand README, add mirrors (#6)
- Streamlines the project into a minimal, script-first CLI for local use.
- Expands the README with clear setup, usage, contributing, and issue-reporting guidance.
- Adds GitHub/GitLab mirrors for visibility; Forgejo remains the source of truth.

Verification
- Install dependencies, add a service account file at the project root, run the bootstrap command for a target UID, and verify the user receives the expected admin role claim.

Reviewed-on: #6
Co-authored-by: Guillaume "B.B." Van Hemmen <GuillaumeHemmen@noreply.git.van-hemmen.com>
Co-committed-by: Guillaume "B.B." Van Hemmen <GuillaumeHemmen@noreply.git.van-hemmen.com>
2025-08-09 16:01:45 +00:00
.gitignore #0000 - Simplify to local CLI, expand README, add mirrors (#6) 2025-08-09 16:01:45 +00:00
CONTRIBUTING.md #0000 - Simplify to local CLI, expand README, add mirrors (#6) 2025-08-09 16:01:45 +00:00
LICENSE #0000 - Add MIT license to project files (#1) 2025-08-03 20:00:29 +00:00
package-lock.json #0000 - Simplify to local CLI, expand README, add mirrors (#6) 2025-08-09 16:01:45 +00:00
package.json #0000 - Simplify to local CLI, expand README, add mirrors (#6) 2025-08-09 16:01:45 +00:00
README.md #0000 - Simplify to local CLI, expand README, add mirrors (#6) 2025-08-09 16:01:45 +00:00
seedAdmin.js #0000 - Simplify to local CLI, expand README, add mirrors (#6) 2025-08-09 16:01:45 +00:00

Firebase Admin Seeder

A simple CLI tool for seeding initial user roles in Firebase via the Firebase Admin SDK.

Project Hosting

The official repository for this project is hosted on my personal Forgejo instance.

For convenience, the project is also mirrored to:

Note: Bug reports and feature requests are only accepted on the Forgejo repository. All links in this README point to the Forgejo instance.

Purpose

When using Firebase custom claims for secure role management, you must manually seed the first account with the required roles. This project provides a straightforward CLI script to automate that process.

Getting Started

1. Prerequisites

  • Node.js (LTS version 22 recommended at the time of writing)
  • A Firebase project with a service account key file

2. Downloading the Project

Clone the repository:

git clone https://git.van-hemmen.com/GuillaumeHemmen/firebase-admin-seeder.git

Alternatively, download it as a .zip or .tar.gz archive from the repository page.

3. Installing Dependencies

Navigate to the project folder and install dependencies:

cd firebase-admin-seeder
npm install

4. Preparing the Service Account File

  1. Download a service account key file from your Firebase console.
    • Go to Project SettingsService AccountsGenerate New Private Key.
  2. Save the file in the project root directory as:
./service-account.json

5. Running the Script

Run the bootstrap command, replacing <user-UID> with the UID of the target user:

npm run bootstrap <user-UID>

You can find the UID in the Firebase Console under Authentication.

The script will assign the role custom claim with the value:

["admin"]

6. Next Steps

After seeding your first admin user, you can continue building your application.

You may also want to check out firebase-customclaim-api — a sample project for managing custom claim roles via your Firebase project UI.

Reporting Issues

Please report bugs and request features exclusively via the Forgejo issue tracker.

Contributing

See the CONTRIBUTING.md file for guidelines.

License

This project is licensed under the terms described in LICENSE.