firebase-admin-dashboard
firebase-admin-dashboard copied to clipboard
Easily create admin dashboards for your Firebase powered apps.
Starter Project For Building Admin Dashboards For Firebase Apps
Easily create admin dashboards for your Firebase powered apps. For example, you can create a merchant dashboard for uploading items on an e-commerce site which uses Firebase as the backend.
Project Structure
- dashboard: contains a react based app which will be served using
Firebase hosting. It hits a Firebase cloud function
apidefined insidefunctionsfolder. - functions: contains an
apicloud function which is basically an Express based API for your app. Your write all your protected business logic here.
Setup
-
Put your Firebase project's name in
.firebaserc. -
Set a secret key for JWT token on Firebase.
firebase functions:config:set auth.secret="<YOUR_SECRET>" -
Cd to
functionsfolder and runyarn install -
For every admin user, run the npm script
yarn run passwdgen <username> <password>and follow further instructions.
-
Cd to
dashboardfolder and runyarn install -
In
dashboard/src/globals.jsfile, set your local and production cloud functions endpoints in API_URL. To get these values, run:for local
firebase serve --only functionsfor production
firebase deploy
Debugging
- Download your project's service account key
.jsonfile and export it in your environment variable.set GOOGLE_APPLICATION_CREDENTIALS=<path_to_json_file>/serviceAccountKey.json - Get a copy of Firebase environment variables set on the server, for running the functions locally. From
functionsfolder, runfirebase functions:config:get > .runtimeconfig.json - Run the functions locally
firebase serve --only functions - Cd to
dashboardfolder and runyarn start
Deploying
Run deploy.sh.
Help
Please open a new issue in case you are facing some problem or write to me at [email protected].