{"id":26784620,"url":"https://github.com/sapna127/bookmatev2","last_synced_at":"2026-04-09T19:49:14.491Z","repository":{"id":250117437,"uuid":"828495474","full_name":"Sapna127/bookMatev2","owner":"Sapna127","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-21T11:52:46.000Z","size":306,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T12:29:25.464Z","etag":null,"topics":["api","context-api","expressjs","mocha-chai","mongodb","nodejs","postman","reactjs","socket-io"],"latest_commit_sha":null,"homepage":"https://book-matev2.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sapna127.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-14T10:27:39.000Z","updated_at":"2025-01-21T11:52:50.000Z","dependencies_parsed_at":"2025-01-21T12:34:25.962Z","dependency_job_id":null,"html_url":"https://github.com/Sapna127/bookMatev2","commit_stats":null,"previous_names":["sapna127/bookmatev2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sapna127%2FbookMatev2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sapna127%2FbookMatev2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sapna127%2FbookMatev2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sapna127%2FbookMatev2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sapna127","download_url":"https://codeload.github.com/Sapna127/bookMatev2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246171769,"owners_count":20735044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","context-api","expressjs","mocha-chai","mongodb","nodejs","postman","reactjs","socket-io"],"created_at":"2025-03-29T10:29:13.999Z","updated_at":"2025-12-30T19:04:17.252Z","avatar_url":"https://github.com/Sapna127.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bookMatev2\n\nThis project is a web application for buying and selling books.  It uses a client-server architecture with a React frontend and a Node.js/Express backend.\n\n\n## Features and Functionality\n\n* **User Authentication:** Users can sign up (as buyers or sellers) and sign in securely.  The application uses local storage for session management, but the backend provides proper authentication endpoints (`/api/v1/users/register`, `/api/v1/users/login`).\n* **Book Listing:** Sellers can create listings for books including name, author, publication, tags, description, and images.\n* **Book Browsing:** Buyers can browse all available books, filtered by category (currently hardcoded as \"Computer Science\" in `client/src/Pages/AllBooks.jsx`).\n* **Book Purchase:**  Buyers can view book details and initiate a purchase (currently a placeholder - the backend `/api/v1/purchases` routes are implemented but frontend functionality is not fully implemented).\n* **Chat Functionality:** A real-time chat system using Socket.IO allows buyers and sellers to communicate.  The chat functionality is functional.\n* **User Profiles:**  Users have profiles (currently a placeholder component).\n\n\n## Technology Stack\n\n**Frontend:**\n\n* React\n* React Router\n* Tailwind CSS\n* Vite\n* Socket.IO-client\n\n\n**Backend:**\n\n* Node.js\n* Express.js\n* Mongoose\n* MongoDB\n* Socket.IO\n* JWT (JSON Web Tokens) for authentication\n* Zod for data validation\n\n\n## Prerequisites\n\n* Node.js and npm (or yarn) installed.\n* MongoDB running locally.  Set the `MONGO_URI` environment variable to your MongoDB connection string.  (See `server/config/db.js`)\n* A code editor (e.g., VS Code, Sublime Text).\n\n\n## Installation Instructions\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/Sapna127/bookMatev2.git\n   ```\n\n2. **Navigate to the client directory:**\n   ```bash\n   cd bookMatev2/client\n   ```\n\n3. **Install client dependencies:**\n   ```bash\n   npm install\n   ```\n\n4. **Navigate to the server directory:**\n   ```bash\n   cd ../server\n   ```\n\n5. **Install server dependencies:**\n   ```bash\n   npm install\n   ```\n\n6. **(Optional) Set up environment variables:** Create a `.env` file in the server directory and add your MongoDB connection string:\n   ```\n   MONGO_URI=your_mongodb_connection_string\n   JWT_SECRET=your_jwt_secret\n   ```\n\n7. **Start the server:**\n   ```bash\n   npm run start\n   ```\n\n8. **Start the client:**\n   ```bash\n   cd ../client\n   npm run dev\n   ```\n\nThe application will be accessible at `http://localhost:5173`.\n\n\n## Usage Guide\n\n1. **Sign up:** Create a new account specifying your name, email, password, and whether you are a buyer or seller.\n2. **Sign in:** Log in using your credentials.\n3. **Browse books:** Use the navigation to view all listed books.\n4. **Create a listing (sellers):**  Use the \"Sell\" page to add a new book listing.  Upload images using the file upload component (`client/src/components/FileUpload.jsx`).\n5. **Purchase a book (buyers):** View book details and use the \"Buy now\" button (currently placeholder).\n6. **Chat with sellers:** Use the chat feature (`client/src/Pages/ChatPage.jsx`) to contact sellers.\n\n\n## API Documentation\n\n**Users:**\n\n* `/api/v1/users/register`: POST - Register a new user.  Requires `name`, `email`, `password`, and `role` (buyer or seller).  See `server/controller/userController.js` and `server/routes/userRoutes.js`.\n* `/api/v1/users/login`: POST - Login.  Requires `email` and `password`.\n* `/api/v1/users/profile`: GET (protected) - Get current user profile.\n* `/api/v1/users/profile`: PUT (protected) - Update user profile.\n\n\n**Books:**\n\n* `/api/v1/books`: POST - Add a new book. Requires `name`, `author`, `publication`, `tags`, `description`, `pictures` (array of image URLs), and `sellerId`.  See `server/controller/bookController.js` and `server/routes/bookRoutes.js` for validation details.\n* `/api/v1/books`: GET - Get all books.\n* `/api/v1/books/:id`: GET - Get a book by ID.\n* `/api/v1/books/:id`: PUT - Update a book by ID.\n* `/api/v1/books/:id`: DELETE - Delete a book by ID.\n\n\n**Purchases:**\n\n* `/api/v1/purchases`: POST - Purchase a book. Requires `userId` and `bookId`.\n* `/api/v1/purchases/:userId`: GET - Get purchased books for a user (protected).\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapna127%2Fbookmatev2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsapna127%2Fbookmatev2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapna127%2Fbookmatev2/lists"}