- Project Overview
- Features
- Technologies Used
- Deployed App
- Screenshot
- Installation Instructions
- API Documentation
- User Authentication
- Deployment
- Contributing
- License
This Book Search Engine App is a full-stack web application built with the MERN stack (MongoDB, Express, React, Node.js) and GraphQL. It allows users to search for books through the Google Books API, save them to their profile, and manage their book collection. The app uses authentication to ensure that users can securely log in and save their data.
- User authentication via JWT (JSON Web Tokens)
- Search for books using the Google Books API
- Save books to the user's profile for easy access
- GraphQL backend with Apollo Server
- User interface built with React and styled with Bootstrap
- Login & Signup: Users can register and log in to the app securely using email and password.
- Book Search: Users can search for books from the Google Books API and view results.
- Save Books: Users can save their favorite books to their personal collection.
- GraphQL API: All requests to the server use GraphQL queries and mutations for efficient data handling.
- Frontend: React, Bootstrap, Apollo Client
- Backend: Node.js, Express.js, Apollo Server
- Database: MongoDB, MongoDB Atlas
- Authentication: JWT (JSON Web Tokens)
- API: Google Books API, custom GraphQL API
Take a look at the app!
To get started with this project, follow these steps:
-
Clone the repository:
git clone https://github.com/ShannonJTaylor/book-tracker.git cd book-tracker -
Install dependencies:
- Install frontend dependencies:
cd client npm install - Install backend dependencies:
cd ../server npm install
- Install frontend dependencies:
-
Set up environment variables:
-
Create a
.envfile in both the client and server directories. Add the necessary variables, such as:For the server:
MONGODB_URI=<your-mongodb-uri> PORT=5000 JWT_SECRET=<your-jwt-secret>
For the client:
REACT_APP_API_URL=<your-graphql-server-url>
-
-
Run the application:
- Run the backend server:
cd server npm start - Run the frontend React app:
cd client npm start
- Run the backend server:
The app should now be running on http://localhost:3000.
-
searchBooks(query: String!):Searches for books based on the provided query string.Example Query:
query { searchBooks(query: "Harry Potter") { title authors description } }
-loginUser(email: String!, password: String!): Logs in a user and returns a JWT token.
Example Mutation
mutation {
loginUser(email: "user@example.com", password: "password123") {
token
}
}-signupUser (username: String!, email: String!, password: String!): Registers a new user and returns a JWT token.
Example Mutation
mutation {
signupUser(username: "newuser", email: "newuser@example.com", password: "password123") {
token
}
}-saveBook(bookData: BookInput!): Saves a book to the user's collection.
Example Mutation
mutation {
saveBook(bookData: { title: "The Great Gatsby", authors: ["F. Scott Fitzgerald"], description: "A novel about the American Dream." }) {
title
authors
}
}Authentication is handled through JWT (JSON Web Tokens). When a user logs in or signs up, a JWT is returned. This token should be stored securely (usually in localStorage or cookies) and included in the Authorization header for any authenticated requests.
The app includes the following components for authentication:
LoginForm: Allows users to log in by providing their email and password.
SignupForm: Allows users to create a new account.
Auth Helper: A utility to manage the JWT in localStorage and check user authentication status.
The app is deployed to Render and uses MongoDB Atlas for database management.
To deploy the app yourself, follow these steps:
-
Set up your MongoDB Atlas cluster and obtain your connection URI.
-
Configure the backend API and frontend with your MongoDB URI and the necessary environment variables.
-
Deploy both the frontend and backend to Render (or any other platform of your choice).
We welcome contributions! Here’s how you can contribute to this project:
-
Fork the repository.
-
Clone your forked repository locally.
-
Create a new branch for your changes.
-
Make your changes and add tests if applicable.
-
Commit your changes and push them to your fork.
-
Create a pull request.
Please make sure to follow the code style used in the project and write clear commit messages.
Made with ❤️ by ShannonJTaylor


