Fireadmin
Application for Managing Firebase Applications. Includes support for multiple environments and data migrations
Install / Use
/learn @prescottprue/FireadminREADME
fireadmin
[![Build Status][build-status-image]][build-status-url] [![Cypress Dashboard][cypress-dashboard-image]][cypress-dashboard-url] [![License][license-image]][license-url] [![Code Style][code-style-image]][code-style-url]
Application for Managing Firebase Applications. Includes support for multiple environments and data migrations
Table of Contents
- Features
- Getting Started
- NPM Scripts
- Application Structure
- Run Your Own
- Requirements
- Before Starting
- Testing
- Cloud Functions Unit
- App E2E
- Deployment
- FAQ
Features
- Manage multiple environments as a single project
- Project Sharing (invite by email coming soon)
- "Action Runner" for common project actions such as data migrations, and generating reports
- Action Features include support for:
- Multiple steps allowing many actions in one run
- Backup phase (for easy backing up data before running your actions)
- Project level tracking of actions which have been run through Action Runner
- Get/Set CORS Config of Storage Buckets
- Testing for React App (Cypress) and Cloud Functions (Mocha)
coming soon
- Support for copying Single Firestore Document in Copy Action
- Map action - for mapping each item in a collection both on RTDB and Firestore
- Authorized Google API Request Panel
- Invite new users by email
- User manager (including role assignment)
- Data Viewer
Interested in adding a feature or contributing? Please open an issue!
Getting Started
Since this is source code, a great place to start is checking the hosted version of Fireadmin available at fireadmin.io.
NPM Scripts
While developing, you will probably rely mostly on npm start; however, there are additional scripts at your disposal:
| yarn <script> | Description |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| start | Serves your app at localhost:3000 |
| start:dist | Builds the application to ./dist and Serves it at localhost:3000 using firebase serve |
| functions:start | Runs Functions REPL locally (uses firebase functions:shell |
| functions:build | Builds Cloud Functions to ./functions/dist |
| functions:test | Runs Functions Unit Tests with Mocha |
| build | Builds the application to ./dist |
| test | Runs E2E Tests with Cypress. See testing |
| lint | Lints the project for potential errors |
| lint:fix | Lints the project and fixes all correctable errors |
Husky is used to enable prepush hook capability. The prepush script currently runs eslint, which will keep you from pushing if there is any lint within your code. If you would like to disable this, remove the prepush script from the package.json.
Application Structure
├── .github # Github Settings + Github Actions Workflows
│ ├── deploy.yml # Deploy workflow (called on merges to "master" and "production" branches)
│ └── verify.yml # Verify workflow (run when PR is created)
├── cypress # UI Integration Tests
├── docs # Docs application (built with Gatsby)
│ ├── content # Content of docs (written in markdown)
│ ├── components # React components used in docs app
│ ├── gatsby-config.js # Gatsby plugin settings
│ └── gatsby-node.js # Gatsby node definitions (how templates are combined with content)
│ └── package.json # Docs package file (docs specific dependencies)
├── functions # Cloud Functions (uses Cloud Functions for Firebase)
│ ├── src # Cloud Functions Source code (each folder represents a function)
│ └── index.js # Functions entry point
├── public # Public assets
│ ├── favicon.ico # Favicon
│ ├── firebase-messaging.sw.js # Messaging Service worker (loaded by Firebase SDK)
│ └── index.html # Main HTML page container for app
├── src # Application source code
│ ├── components # Global Reusable Presentational Components
│ ├── containers # Global Reusable Container Components
│ ├── layouts # Components that dictate major page structure
│ │ └── CoreLayout # Global application layout in which to render routes
│ ├── routes # Main route definitions and async split points
│ │ ├── index.js # Bootstrap main application routes with store
│ │ └── Home # Fractal route
│ │ ├── index.js # Route definitions and async split points
│ │ ├── assets # Assets required to render components
│ │ ├── components # Presentational React Components
│ │ ├── modules # Collections of reducers/constants/actions
│ │ └── routes ** # Fractal sub-routes (** optional)
│ ├── static # Static assets
│ └── utils # Application-wide utils (form validation etc)
├── .firebaserc # Firebase project settings (including settings for CI deployment)
├── cypress.json # Cypress Integration Test settings
├── database.rules.json # Firebase Real Time Database Rules
├── firebase.json # Firebase resource settings (including which folders are deployed)
├── firestore.indexes.json # Firestore Indexes
├── firestore.rules # Firestore Database Rules
└── storage.rules # Cloud Storage Rules
Run Your Own
Requirements
- node
^10.18.0(node 10 suggested in order to match newest [Cloud Functions Runtime][functions-runtime-url])
Before Starting
- Make sure you have enabled billing on your Firebase account - external API communication requires setting up a payment method (you are only charged based on usage)
- Create an account on Algolia - Create a new app, you will need the API keys later
- Install Firebase Command Line Tools:
npm i -g firebase-tools
Local Environment Setup
-
Install dependencies:
yarn install -
Create a Web app within the Firebase Console of your project (config will be used in next step)
-
Create a
.env.localthat has the following format (with your values filled from previous step):REACT_APP_FIREBASE_apiKey=<- api key -> REACT_APP_FIREBASE_authDomain=<- auth domain -> REACT_APP_FIREBASE_databaseURL=<- database URL -> REACT_APP_FIREBASE_projectId=<- project ID -> REACT_APP_FIREBASE_storageBucket=<- storageBucket -> REACT_APP_FIREBASE_messagingSenderId=<- message sender ID -> REACT_APP_FIREBASE_appId=<- project app id -> REACT_APP_FIREBASE_PUBLIC_VAPID_KEY=<- project app id -> REACT_APP_ALGOLIA_APP_ID=<- -> REACT_APP_ALGOLIA_API_KEY=<- -> -
Create
functions/.runtimeconfig.jsonfile that looks like so:{ "algolia": { "api_key": "<- your API KEY ->", "app_id": "<- your Algolia APP ID ->" }, "gmail": { "email": "<- gmail account for sending invite emails ->", "password": "<- password for ^ email ->" }, "encryption": { "password": "<- your own made up encryption password for service accounts -> " } } -
Set Functions config variables to match the file you just made (for the deployed version of your functions):
firebase functions:config:set $(jq -r 'to_entries[] | [.key, (.value | tojson)] | join("=")' < functions/.runtimeconfig.json) -
Build Project:
yarn build -
Deploy to Firebase:
firebase deploy(deploys, Cloud Functions, Rules, and Hosting) -
Start Development server:
npm startNOTE: You can also useyarn start:distto test how your application will work when deployed to Firebase -
View the deployed version of the site by running
firebase open hosting:site
Deployment
CI Deploy (recommended)
Note: Config for this is located within .github/workflows/app-deploy.yml. firebase-ci has been added to simplify the CI deployment process by getting settings from the .firebaserc. All that is required is providing authentication with Firebase:
- Have at least two Firebase projects to ready to use, one for each environment (staging and production)
- Replace info within
.firebasercunder both theprojects,ci, andtargetssections - Login:
firebase login:cito generate an authentication token. This token will be used to give the CI provider rights to deploy on your behalf. Settings are provided for Gitlab, but any CI provider can be used. - Set
FIREBASE_TOKENenvironment variable within Github Actions secrets - Add the following environment va
Related Skills
openhue
339.3kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
339.3kElevenLabs text-to-speech with mac-style say UX.
weather
339.3kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.5kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
