This project was bootstrapped with Create React App.
RateAudio is application build on React, Firebase Functions and Database. for voting songs in collection. It picks X songs from collection to vote on and display result if user successfully posted a vote.
To run application follow steps below:
-
Create Firebase project on https://firebase.google.com/
-
In your project:
- Select Authentication -> Sign-In method and allow login with Google
- Select Database and create firestore database and setup database access rules
-
Install node.js if you don't have it already. You can check if is installed typing
node -v
-
Install Firebase CLI
npm install -g firebase-tools
. You can check if is installed typingfirebase --version
. -
Login to firebase CLI
firebase login
-
Clone this repository and go to cloned directory
cd audioRate
-
Install Google Functions dependencies:
npm --prefix functions install
-
Init project by typing
firebase init
and select everything by typing 'a'. Don't overwrite files if asked. -
(Optionally) Setup emulators for hosting and functions. It provides environment for testing and debugging
-
Select existing project
-
Bind downloaded repository with your created firebase project:
firebase use --add
and select you project -
To make functions accessible your firestore database go to firebase console -> settings -> service accounts and generate new private key at bottom.
-
Place downloaded file in functions directory and rename it to
credentials.json
. -
Run
firebase serve --only functions
-
In firebase console add your firebase app to web app.
-
Go to settings and choose your web app and select configuration
-
Copy credentials and go to project's src directory.
-
Paste credentials in firebase_credentials.js and type on last line export default (variable config name). In most cases 'firebaseConfig'
-
Install dependencies
npm install
-
Make .env file in project root directory
- Paste function url in .env file in
REACT_APP_API_URL
- Make list of audio files separated by space. By default should look like this
REACT_APP_SONGS_LIST=CantinaBand3.wav preamble10.wav
- Paste function url in .env file in
-
Type
npm start
to run app locally and go to http://localhost:3000 once it's done.
- To deploy function type
firebase deploy --only functions
- Select hosting firebase and register application.
- Copy url of deployed function and replace it .env file. Url can be found in firebase console https://console.firebase.google.com/ under Functions tab
- To deploy app type:
npm run build
and thenfirebase deploy --only hosting