This MERN (MongoDB, Express.js, React.js, Node.js) project, "book-store," is an online book store application featuring CRUD (Create, Read, Update, Delete) functionalities for managing a collection of books. π€
- Book Collection Management:
- Add new books with detailed information like - image, title, description, price, author. π·
- View the list of available books with their details. π
- Edit existing book information. ποΈ
- Delete books from the collection. ποΈ
Check out the live demo of the Book Store application:
The project utilizes the following technologies:
- React.js: A JavaScript library for building user interfaces. π
- Vite.js: A build tool that aims to provide a faster and leaner development experience for modern web projects. β±οΈ
- Sass/SCSS: A preprocessor scripting language that is interpreted or compiled into Cascading Style Sheets (CSS). π¨
- Context API: Used for state management in React.js applications. π§©
- ESLint: A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. π
- Node.js: A JavaScript runtime environment for executing JavaScript code server-side. π»
- Express.js: A web application framework for Node.js used to build APIs and web apps. π
- MongoDB: A NoSQL database used to store application data. πΎ
- Mongoose: An ODM (Object Data Modeling) library for MongoDB and Node.js. π¦ΈββοΈ
- dotenv: A zero-dependency module that loads environment variables from a .env file into process.env. πΏ
client/
βββ src/
β βββ assets/
β βββ context/
β β βββ Context.jsx
β βββ pages/
β β βββ Books/
β β β βββ Book/
β β β β βββ Book.jsx
β β β β βββ Book.scss
β β β βββ Books.jsx
β β β βββ Books.scss
β β βββ Editor/
β β βββ Editor.jsx
β β βββ Editor.scss
β βββ App.jsx
β βββ index.scss
β βββ main.jsx
βββ .env
βββ .eslintrc.cjs
βββ .gitignore
βββ index.html
βββ package-lock.json
βββ package.json
βββ vite.config.js
server/
βββ config/
β βββ dbConfig.js
βββ controllers/
β βββ booksController.js
βββ models/
β βββ Book.js
βββ routes/
β βββ Books.js
βββ services/
β βββ bookService.js
βββ .env
βββ .gitignore
βββ index.js
βββ package-lock.json
βββ package.json
βββ vercel.json
The client
directory contains the front-end part of the application built with React.js. It includes:
- src/assets: Assets used in the application (images, etc.).
- src/context: Context file(s) used for state management (Context.jsx).
- src/pages: Components representing different pages/routes in the app (Books, Editor, etc.).
- src/App.jsx: Main React component representing the root of the application.
- src/index.scss: Main SCSS file for styling.
- src/main.jsx: Main entry point for the React app.
The server
directory contains the back-end part of the application built with Node.js and Express.js. It includes:
- config: Configuration files, e.g., database configuration (dbConfig.js).
- controllers: Controllers handling the business logic for different routes (booksController.js).
- models: Mongoose models or schemas representing entities (Book.js).
- routes: API routes and their corresponding controller functions (Books.js).
- services: Additional services or utilities for the application (bookService.js).
To run the application locally, follow these steps:
- Clone the Repository:
git clone https://github.com/sahilatahar/book-store.git cd book-store
- Setup the Client:
cd client npm install # Or yarn install if using yarn
- Setup the Server:
cd ../server npm install # Or yarn install if using yarn
- Set up Environment Variables:
- Frontend (.env in client/): Create a
.env
file in theclient/
directory and addVITE_API_URL=server_url_here
. - Backend (.env in server/): Create a
.env
file in theserver/
directory and addMONGODB_URI=your_mongodb_uri
andPORT=your_preferred_port_number
.
- Frontend (.env in client/): Create a
- Run the Application:
- Start the React client:
cd ../client npm run dev # Or yarn start if using yarn
- Start the Node.js server:
cd ../server npm run dev # Or yarn start if using yarn
- Start the React client:
- Access the Application: Open your web browser and visit http://localhost:5173 to use the book store application.
Contributions are welcome! If you'd like to improve this project, please fork the repository and create a pull request. Feel free to open an issue if you find any bugs or have suggestions for enhancements.
This project is licensed under the MIT License. You can find more details in the LICENSE file.
This project was created while learning backend development. It may contain code or practices that reflect a learning phase. However, contributions to improve and enhance the project are encouraged.