AlbumDB is an album "to-listen" list built with the MERN stack and FusionAuth.
- Clone the repository to your local machine and install dependencies using npm by running the following commands:
git clone https://github.com/joeycs/albumdb.git
cd albumdb
npm i
- In the project's root directory, create a file called
.env
with the following contents:
REACT_APP_SERVER_PORT=5000
- In the project's
server/
directory, create a file called.env
with the following contents:
API_KEY=XXXXXXXX
APPLICATION_ID=XXXXXXXX
ATLAS_URI=XXXXXXXX
CLIENT_ID=XXXXXXXX
CLIENT_PORT=3000
CLIENT_SECRET=XXXXXXXX
FUSION_AUTH_PORT=9011
REDIRECT_URI=http://localhost:5000/oauth-callback
SERVER_PORT=5000
-
Install Docker Desktop and ensure it is running
-
Create a FusionAuth account
-
Install and deploy FusionAuth by running the following commands in a new terminal:
curl -o docker-compose.yml https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/.env
docker-compose up
-
Open FusionAuth which will now be running at http://localhost:9011
-
Create a new Application
-
Click "Settings" in the left menu
-
Click "API Keys"
-
Click the add button in the top-right
-
Toggle every column in the Endpoints menu
-
Click the save button in the top-right
-
Navigate to
server/.env
in your project directory and replace theX
s in theAPI_KEY
field with the Id of the API key you just created -
Go to "Applications" and click the edit button next to your Application
-
Enter
http://localhost:5000/oauth-callback
in theAuthorized Redirect URLs
field andhttp://localhost:3000
in theLogout URL
field -
Click the save button in the top-right
-
Click the view button next to your Application
-
In
server/.env
, replace theX
s in theAPPLICATION_ID
,CLIENT_ID
, andCLIENT_SECRET
fields with your Application'sId
,Client Id
, andClient secret
values respectively
-
Create a MongoDB Atlas account
-
Click "New Project" in the top-right to create a new Project
-
Go to "Clusters" and click "Create a New Cluster" in the top-right
-
Under your new Cluster, click "Connect" and then "Connect your application"
-
Ensure "DRIVER" is set to "Node.js" and "VERSION" is set to "3.6 or later"
-
Copy the connection string
-
Navigate to
server/.env
and replace theX
s in theATLAS_URI
field with your connection string -
In the connection string, replace
<password>
with your MongoDB password and replacemyFirstDatabase
with the name of your project
- Ensure you are in the project's root directory
albumdb/
and deploy the React app by running the following commands in a new terminal:
npm run build
serve -l 3000 -s build
- To connect to the MongoDB database, run the following commands in a new terminal:
cd server
nodemon server
- The project can now be used by visiting http://localhost:3000
- Generate album art when an album is added to the list
- Generate a Spotify link when an album is added to the list