Mood-Generated Soundtracks
Create a profile, Pick your mood, Listen to music, Live your life
A fullstack web application that uses a React front-end, a Ruby on Rails back-end and a PostgresQL database.
-
Creating custom serializers to display user view data.
-
Integrating MUI dialog boxes.
-
Client-side routing that works in unison with server side custom routes.
-
Authentication/authorization using a session hash to allow user playlists to persist.
-
Learning to use the React Material UI library.
-
In the future I want to add:
- Advanced audio player with autoplay and playlist features
- Allow users to add their own music
- Playlist editing capabilities
- Auto-generated playlists by geo-location
- Ability to rate songs
- GitHub [here] https://github.com/JawaraGordon/life-music
β Email me for guest login credentials: jawara@jawaragordon.com
π΅ Press the Music button.
β Choose a Mood from the Mood-bar to generate a random list of songs with that vibe.
β A new list of songs will be generated each time a Mood is pressed.
β Save the list of songs with the "save" button at the bottom of the playlist.
β View your saved playlists with the Playlists button.
β Press the Songs button at the top of the playlist to see a page with all of the songs or choose to see all of the songs categorized by mood.
β While on the music tab, press the "Time Hop" button next to the clock to generate a random list of songs based on the current time of day.
β Pressing the logo in the top left corner takes you to user's profile view.
src
folder contains the following files:
../src/
βββ App.css
βββ index.css
βββ index.js
βββ components/
βββ AboutDialog.js
βββ AccountCard.js
βββ App.js
βββ BasicMenu.js
βββ Clock.js
βββ DeleteDialog.js
βββ Header.js
βββ Login.js
βββ LoginForm.js
βββ MoodBar.js
βββ NavBar.js
βββ SavePlaylistDialog.js
βββ SignUpForm.js
βββ pages/
βββ About.js
βββ Account.js
βββ AllSongs.js
βββ Music.js
βββ MyPlaylists.js
βββ SongsByMood.js
βββ playlists/
βββ SongList.js
βββ styles/
βββ index.js
import { BrowserRouter } from 'react-router-dom';
Imports BrowserRouter
component from React Router, wraps App
as the top level component.
-
This project was bootstrapped with Create React App.
- 18.2.0
- 3.1.2
- 7.0.3.1
- v18.7.0
- (PostgreSQL) 14.4
- Homebrew
- npm
- rvm
-
macOS 10+
-
Windows 10+
emotion/react": "^11.10.0",
emotion/styled": "^11.10.0",
fontsource/roboto": "^4.5.8",
mui/icons-material": "^5.8.4",
mui/material": "^5.10.0",
mui/styled-engine-sc": "^5.10.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.5"
Windows Instructions here
$ brew tap heroku/brew && brew install heroku
$ heroku login
$ rvm install 3.1.2 --default
$ gem install bundler
$ gem install rails
Heroku requires Postgresql add 'pg gem' to Gemfile.
//Gemfile gem "pg", "~> 1.1"
Install Postgres.
$ brew install postgresql
$ brew services start postgresql
Initiate a new git repository inside of your project directory using git init
Tell the app to use PostgreSQL.
$ rails new your-project-name --api --minimal --database=postgresql
$ bundle lock --add-platform x86_64-linux --add-platform ruby
Configure React to work in Rails production environment.
From the root directory:
npm install --prefix client
Add this code:
web: bundle exec rails s release: bin/rake db:migrate
web: PORT=4000 npm start --prefix client api: PORT=3000 bundle exec rails s
$ npm run build --prefix client
mv client/build/\* public
get "*path", to: "fallback#index", constraints: ->(req) { !req.xhr? && req.format.html? }
$ rails g controller fallback_controller
class FallbackController < ActionController::Base def index render file: 'public/index.html' end end
Add this code:
{
"name": "heroku-deploy",
"description": "Build scripts for Heroku",
"engines": {
"node": "15.6.0"
},
"scripts": {
"clean": "rm -rf public",
"build": "npm install --prefix client && npm run build --prefix client",
"deploy": "cp -a client/build/. public/",
"heroku-postbuild": "npm run clean && npm run build && npm run deploy"
}
}
$ heroku create
$ git add .
$ git commit -m 'Initial commit'
$ heroku buildpacks:add heroku/nodejs --index 1
$ heroku buildpacks:add heroku/ruby --index 2
$ git push heroku main
$ heroku run rails db:migrate db:seed
$ heroku open
$ git config --list --local | grep heroku
heroku local -f Procfile.dev
- MIT