A simple yet functional book management application that allows users to add, update, view, and delete books. This application includes both a frontend built with React and a backend with Express and MySQL.
- Add New Books: Users can add new books to the collection with details including title, description, price, and cover image.
- Update Books: Users can update the details of existing books.
- Delete Books: Users can remove books from the collection.
- View Books: Users can view a list of all books in the collection.
-
Frontend:
- React
- React Router
- Tailwind CSS
- Framer Motion
-
Backend:
- Node.js
- Express
- MySQL
-
Clone the repository:
git clone https://github.com/Prayag-09/book-shop.git cd book-shop
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Create a
.env
file in thefrontend
directory:Copy the content from
.env.example
and paste it into a new file named.env
in thefrontend
directory. Update theREACT_APP_BACKEND_URL
with your backend URL.REACT_APP_BACKEND_URL=http://localhost:3306
-
Start the development server:
npm start
-
Visit
http://localhost:3000
in your browser to view the application.
-
Navigate to the backend directory:
cd backend
-
Install dependencies:
npm install
-
Create a
.env
file in thebackend
directory:Copy the content from
.env.example
and paste it into a new file named.env
in thebackend
directory. Update theMYSQL_ADDON_URI
with your database connection string.MYSQL_ADDON_URI=mysql://@mysql.services.clever-cloud.com:3306/dbname
-
Run the database setup script:
node setupDatabase.js
-
Start the server:
npm start
-
Visit
http://localhost:5173
to interact with the API (if running locally).
- GET /books: Retrieve all books.
- GET /books/:id: Retrieve a single book by ID.
- POST /books: Add a new book.
- PUT /books/:id: Update an existing book by ID.
- DELETE /books/:id: Delete a book by ID.
-
Add a Book:
- Navigate to the "Add New Book" page.
- Fill in the form with book details and submit.
-
Update a Book:
- Navigate to the "Update" page for a specific book.
- Modify the details and submit.
-
Delete a Book:
- On the list of books, click "Delete" next to the book you want to remove.
-
View Books:
- View all books on the homepage.