- 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> |
||
---|---|---|
.gitignore | ||
CONTRIBUTING.md | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md | ||
seedAdmin.js |
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
- Download a service account key file from your Firebase console.
- Go to Project Settings → Service Accounts → Generate New Private Key.
- 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.