-
Notifications
You must be signed in to change notification settings - Fork 304
Setup your project
-
In this project you will find the following:
- frontend - React Native source code
- backend - Firebase Functions source code
- admin - admin panel source code
-
Go to the frontend/app.json -> Change the android -> pachage for one of your own, example: com.xxxxx.yyyyy.
First you need to install Nodejs and npm, this is different depending on the OS you are running so it is easier to check the node page
Install expo, if it fails run you might need to run this with sudo
npm install expo-cli --global
Install the needed packages while in the frontend folder
npm install expo
npm install
- Create a new Firebase project in the following link
- after that do the following:
- Go to the Realtime Database page:
- Create.
- select test rules.
- In the main page:
- Add web app.
- Copy the firebaseConfig and paste it into frontend/App.js/firebaseConfig of the project and paste them for the placeholder var that is already there
- Copy the firebaseConfig and paste it into admin/config/config.js of the project and replace the var that's already there
- Go to the Authentication page:
- Enter Sign-In Method.
- Select and activate: Email and password
- Create an admin account from the users page and copy the uid of that account
- Go to the Firestore page:
- Create Firestore Database
- Start in test mode
- Add a collection called admin with a doc with an id that's the uid of the admmin account
- Go to the rules and copy the contents of the file firestore_rules.txt that is in the root folder of the project and paste them in the rules
- In the indexes tab create the following index:
- Go to the Storage Page:
- Click on get started.
- Next
- Choose a location and click Done
- Go to the rules and copy the contents of the file firestore_rules.txt that is in the root folder of the project and paste them in the rules
- Go to the Realtime Database page:
run the following commands while inside the admin folder
npm install
npm run build
- Install firebase tools, by running the following comand on your terminal
npm install -g firebase-tools
- Open the backend folder on your terminal by cd to it.
- Copy the files in the folder to another place on your pc.
- Login to your firebase account by running the following comand:
firebase login
- initialize the setup project with:
firebase init
- Enter the following options into the terminal: a. ? Are you ready to proceed? Y b. ? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices. Functions && Hosting. c. ? Please select an option: Use an existing project-> choose your project d. ? What language would you like to use to write Cloud Functions? Javascript e. ? Do you want to install dependencies with npm now? Y h. ? Configure as a single-page app (rewrite all urls to /index.html)? Y e. ? Do you want to use ESLint to catch probable bugs and enforce style? Y
- with the index.js file you copied in the begining of the firebase functions setup: a. replace index.js inside the functions folder.
- copy the contents of the build folder inside your admin folder to public
- Open firebase.json and remove the line inside the "predeploy" var
You can now deploy the firebase backend and admin page by running the following command while inside the backend folder: 1. firebase deploy
You can now deploy the project to your device by doing:
1. Run expo start -c
2. Run it on any device you want
If you want to get a standalone apk or ipa file, you'll have to go to expo.io and create an account then do the following:
- Run
expo build:android
orexpo build:ios
- wait for it to deploy, you can check it on your expo.io account
- Run
expo credentials:manager
and choose android copy the Google Certificate Fingerprint - go to your firebase dashboard and add an android project pasting the sha1 key there along with the package name that you have in the app.json expo.android.package
- download the google-services.json
- move the google-service.json to the frontend folder
- copy the apikey that's inside the google-services.json to app.json -> expo.android.config.googleSignIn.api.key
- Run
expo build:android
orexpo build:ios
again
That is it! You have successfully deployed the project