Installing & Running FakeFlix on MacOS¶
Required Software¶
First, install node, which includes the Node Package Manager (npm
):
you can run the installation package that you download from the Node website. Be sure to follow the instructions for running the installer carefully to install the latest LTS version (version 20.17.0 as of the release of this assignment).
If you already have npm installed, you can upgrade to the latest version using the following commands:
- Clear your
npm
cache
n
Node version manager
- Upgrade your version of node to the latest stable version
Installing FakeFlix¶
The following commands should be executed in the terminal. These were tested with the bash
shell, although the zsh
shell should also function properly.
- Clone the project
- Navigate into the project directory
- Install dependencies using the Node Package Manager
- Create a
.env
file
- Next, we need to get an API key so that FakeFlix can download movie data to dsiplay in the app. We will be using a website called TMDB to accomplish this. Navigate to The Movie Database (TMDB) and sign up for a free account. You can do this by clicking on the menu option highlighted in red in the screenshot below. When asked for the registration reason, you can state that you are learning React programming for a university class.
- After registering for the API, Navigate to the API settings page that contains your API key, as illustrated below. Copy the "API Key", you will not use the "API Read Access Token".
- Next, open your
.env
file that you created in Step 4 (you may need to enable your file explorer to show hidden files) and add the lie below, replacing the right hand side with the TMDB API key that you copied. Save the File and move onto the next step.
- Fakeflix uses the Firebase service's real-time database and cloud authentication features to enable sign ups and persist user data across sessions. To get the app to work properly, you will need to sign up for a Firebase account and enable these features. First, navigate to the Firebase website, and sign up for a free account. Then, create project called "FakeFlix" as shown below:
On the next screen, you can enable the Google Analytics and click "continue" as shown below.
When asked to configure the account for Google Analytics, you can use the default account, as shown below.
Within your Firebase project, create a webapp by clicking on the Icon as indicated below:
Call your webapp "FakeFlix", do not enable hosting, and then click on the "Configure App" button, as shown below.
The next screen will show the API configuration for your app. Copy the Firebase Configuration text as shown below and paste in a temporary text file, we will come back to this information later. Finally, click on the "Continue to Console" button.
Once you are back at the Firebase project console screen, it's time to enable the FireStore database. Open the "Build" menu on the left-hand side of the screen and then click on the "Firestore Database" option, as shown below.
On the next page, click on the "Create Database" button, as shown below.
On the first configuration screen, leave all of the settings as default and click on the "Next" button, as shown below.
On the second configuration screen, be sure to change the database mode from "production mode" to "test mode" as shown below. Then click on the "Create" button. It will take a few minutes for Firebase to provision the database.
Now that the Firestore database has been provisioned, we need to enable user authentication. To do this, go back to the Firebase console, open up the left-hand menu, and click on the "Authentication" option, as shown below.
On the next screen, click on the "Get started" button to set up user authentication, as shown below.
On the resulting configuration screen, click on the option for "Email/Password", as shown below.
On the second configuration screen, ensure that both options for "Email/Password" and "Password-less Link" are both enabled, as shown below.
Your Firebase account is now completely configured, and you can finish setting up your app!
- Next, take the Firebase configuration that you copied earlier, and format as shown below, and insert this into your
.env
file underneath the line that contains your TMDB API key.
REACT_APP_FIREBASE_API_KEY=REACT_APP_FIREBASE_API_KEY
REACT_APP_FIREBASE_AUTH_DOMAIN=REACT_APP_FIREBASE_AUTH_DOMAIN
REACT_APP_FIREBASE_PROJECT_ID=REACT_APP_FIREBASE_PROJECT_ID
REACT_APP_FIREBASE_STORAGE_BUCKET=REACT_APP_FIREBASE_STORAGE_BUCKET
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=REACT_APP_FIREBASE_MESSAGING_SENDER_ID
REACT_APP_FIREBASE_APP_ID=REACT_APP_FIREBASE_APP_ID
REACT_APP_FIREBASE_MEASUREMEMT_ID=REACT_APP_FIREBASE_MEASUREMEMT_ID
- Finally, you can start the server! Running the command below should compile and run the app, opening the app in your browser window.
🧪 Testing¶
To run the project linter, run:
To run the jest test suite, run: