A reading tracker web application that allows users to search for books using the Open Library API, save them to their personal digital shelf, and manage their book collection.
Sprint 1/2:
- Alston
- Danny
Sprint 3:
- Kim
- Maddie
Sprint 4:
- Tav
- Tia
Our Shelves lets users:
- Search for books by title using the Open Library API.
- Add books to their personal shelf stored in a MySQL database.
- View their saved books.
- Delete books from their library.
- Interact with a React frontend and Express backend, connected via REST API.
- Add personal notes to books.
- Track bookmarks / reading progress.
- Organize books into multiple shelves.
- Share shelves and notes with friends.
- Support light/dark theme customization.
| Layer | Technology |
|---|---|
| Frontend | React (Vite), React Router |
| Backend | Node.js, Express.js |
| Database | MySQL (mysql2/promise) |
| External API | Open Library API |
| Packaging | Docker |
| Deployment | Ubuntu Server |
Make sure the following are installed:
# db & api
MYSQL_USER=username
MYSQL_PASSWORD=superSecurePassword
MYSQL_DATABASE=my_favorite_db
# api
DB_PORT=3306
PORT=3000
HOST=localhost
# frontend
VITE_API_URL=http://${HOST}:${PORT}For production, replace
localhostwith your server IP or domain name.
git clone https://github.com/your-username/our-shelves.git
cd our-shelvescd backend
npm install
cd ../frontend
npm install- Create
.envinside root directory. - Copy and paste the environment variable structure shown above.
This project includes unit tests for both the frontend and backend, integration tests, as well as end-to-end (E2E) tests.
Purpose: Tests individual backend controllers in isolation. All database calls (db.js) and fetch requests are mocked, so no database or network connection is required.
How to Run:
cd backend
npm testThis command runs all files ending in .test.js found in the backend/tests folder.
Purpose: Tests individual React components in a simulated browser environment. All fetch API calls are mocked in the setup file (frontend/src/setupTests.js).
How to Run:
cd frontend
npm testThis command will start Vitest in "watch mode," automatically re-running tests as you save changes.
To generate a coverage report, cd into the respective directory (backend/frontend) and run the following command
npm test -- --coveragePurpose: Tests the live application routes and controllers against a real, temporary database. This ensures all database queries, joins, and logic work as expected.
How to Run:
cd backend
npm run test:integrationPurpose: Simulates a real user journey in a real browser. It tests the complete application flow, from searching for a book to adding it to the library and deleting it.
How to Run (2 Steps):
- Start the frontend dev server:
cd frontend
npm run dev- Open the Cypress runner:
cd frontend
npx cypress openThis will open the Cypress app. From there, you can choose a browser and run the app.cy.js test suite.
Purpose: Runs the tests in the terminal without opening a popup window. This mode is required to generate video recordings and error screenshots.
How to Run:
- Ensure the frontend dev server is running (if not already):
cd frontend
npm run dev- Open a new terminal:
cd frontend
npx cypress runOutput:
- Videos are saved to: frontend/cypress/videos
- Screenshots (on failure) are saved to: frontend/cypress/screenshots
The backend, frontend, and MySQL server can all be built and ran with one command:
docker compose up -dUpdating:
apt update
yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yqq upgradeInstall Git
apt install gitInstall Docker Engine With apt Repository Setup apt repo:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get updateInstall docker package:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginConfirm docker is installed and running:
sudo systemctl status dockerInstall docker compose
sudo apt-get update
sudo apt-get install docker-compose-plugingit clone https://github.com/your-username/our-shelves.git
cd our-shelvesnano .envInside nano text editor:
# db & api
MYSQL_USER=username
MYSQL_PASSWORD=superSecurePassword
MYSQL_DATABASE=my_favorite_db
# api
DB_PORT=3306
PORT=3000
HOST=<VM IP>
# frontend
VITE_API_URL=http://${HOST}:${PORT}Ctrl + o to save Ctrl + x to exit
Check if .env exists:
ls -aThe application can be built and deployed with one command now:
docker compose up -dThe frontend will be running on the VMs IP address defined in the env, on PORT 5173. ex: http://0.0.0.0:5173 (replace 0.0.0.0 with VM IP)
| Method | Endpoint | Description |
|---|---|---|
| GET | /books |
Fetch all saved books |
| POST | /books |
Add a new book |
| DELETE | /books/:id |
Delete a book by ID |
| GET | /books/search/:bookName |
Search books via Open Library API |
Updating Deployed App:
git pull
docker compose up -buildStopping:
docker compose down- Ensure
.envfiles are correctly configured - Confirm no leading spaces in env variables
- Check firewall settings if deploying to a remote server (allow ports 3000 and 5173).
This project is for educational use as part of a student project at Green River College.