The project consists of a web application that allows users to search for books and create personalized Spotify playlists based on the searched book's genre. Readify is divided into a client-side and server-side application.
The client-side application is built using React and allows users to search for books and view their search history. It provides the following components:
BookEntryCard.jsx
: Renders a card for a book entry, displaying the book's title, description, and image.Header.jsx
: Renders the application header.PlayerCard.jsx
: Renders a card for the Spotify player, allowing users to play the created playlists.UserHistoryItem.jsx
: Renders an item in the user's search history, displaying the book's title and image.MainContainer.jsx
: Acts as the main container component, managing the state and handling user interactions.UserHistoryContainer.jsx
: Renders the user's search history.App.jsx
: The root component of the application, handling the overall layout and routing.index.html
: The HTML template for the application.index.js
: The entry point of the client-side application.
The server-side application is built using Express.js and interacts with external APIs (Google Books API and Spotify API) to fetch book and music data. It provides the following files:
server.js
: The main server file that sets up the Express server and defines the server routes.router.js
: Defines the server routes and their corresponding handlers.model.js
: Contains the database configuration and query functions for interacting with the database.spotifyController.js
: Handles the authentication with Spotify, playlist creation, and track recommendations.dbController.js
: Handles saving search history to the database and retrieving it.bookController.js
: Handles fetching book data from the Google Books API.
To run the project locally, follow these steps:
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd <project-directory>
- Install the dependencies for the client-side application:
cd client npm install
- Install the dependencies for the server-side application:
cd ../server npm install
- Start the server:
npm start
- Start the client-side application (in a separate terminal):
cd ../client npm start
- Open your browser and navigate to
http://localhost:3000
to access the application.
- Enter a book title in the search input field.
- Click the "Search" button to search for the book.
- The search results will be displayed as cards. Click on a card to view more details about the book.
- A Spotify playlist based on the book's genre will be created automatically.
- Use the Spotify player card to play the created playlist.
- The search history will be displayed in the user's search history section.
The server exposes the following API endpoints:
GET /
: Retrieves the main HTML page.GET /dist/bundle.js
: Retrieves the bundled JavaScript file.POST /api/get-title
: Handles the book search request, creates
a Spotify playlist, and saves the search history to the database.
GET /api/callback
: Handles the Spotify authentication callback.
- React
- Express.js
- Node.js
- PostgreSQL
- Spotify API
- Google Books API
- Webpack
Contributions to the project are welcome! If you find any issues or would like to propose enhancements, please submit a pull request.