{"id":22206753,"url":"https://github.com/labib2003/book-catalog-backend","last_synced_at":"2025-03-25T03:47:10.132Z","repository":{"id":181374503,"uuid":"666665379","full_name":"Labib2003/book-catalog-backend","owner":"Labib2003","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-17T09:12:00.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T04:25:55.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://book-catalog-backend-one.vercel.app","language":"TypeScript","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/Labib2003.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":"2023-07-15T06:55:11.000Z","updated_at":"2023-07-15T07:22:02.000Z","dependencies_parsed_at":"2025-01-30T04:33:54.037Z","dependency_job_id":null,"html_url":"https://github.com/Labib2003/book-catalog-backend","commit_stats":null,"previous_names":["labib2003/book-catalog-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Labib2003%2Fbook-catalog-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Labib2003%2Fbook-catalog-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Labib2003%2Fbook-catalog-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Labib2003%2Fbook-catalog-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Labib2003","download_url":"https://codeload.github.com/Labib2003/book-catalog-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245394784,"owners_count":20608123,"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":[],"created_at":"2024-12-02T18:17:48.398Z","updated_at":"2025-03-25T03:47:10.108Z","avatar_url":"https://github.com/Labib2003.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backend for Simple Book Catalog Application\n\nThis is the readme file for the backend part of the Simple Book Catalog Application project. The backend is responsible for providing the necessary APIs to serve data to the frontend and handle the logic. This readme will provide an overview of the project, instructions for setup, and details about the implemented API routes.\n\n# Overview\n\nThe Simple Book Catalog Application is a full stack web project that allows users to view and manage a catalog of books. The backend is built using `Express` and `Mongoose`. It provides various API routes to handle user authentication, book management, and data retrieval.\n\n# Setup\n\nTo set up the backend locally, please follow these steps:\n\n### Clone the backend repository from GitHub:\n\n[Backend Repository Link](https://github.com/Labib2003/book-catalog-backend)\n\n### Install the required dependencies:\n\nRun the following command in the project directory:\n\n```nodejs\nnpm install\n```\n\n### Configure the environment variables:\n\nCreate a .env file in the root directory and provide the necessary values for the following variables:\n\n```.env\nPORT=3000\nDATABASE_URL=insert-database-url\nBCRYPT_SALT_ROUNDS=insert-bcrypt-salt-rounds\nJWT_SECRET=insert-jwt-secret\nJWT_EXPIRES_IN=insert-jwt-expiration-time\nJWT_REFRESH_SECRET=insert-refresh-token-secret\nJWT_REFRESH_EXPIRES_IN=insert-refresh-token-expiration-time\n```\n\n### Start the server:\n\nRun the following command:\n\n```nodejs\nnpm start\n```\n\nThis will start the backend server at http://localhost:3000.\n\n# Dependencies:\n\n### Production Dependencies\n\n- Node.js: A JavaScript runtime environment used for building server-side applications.\n- Express.js: A web application framework for Node.js that simplifies the development of server-side applications.\n- TypeScript: A typed superset of JavaScript that compiles to plain JavaScript and provides static type checking.\n- MongoDB: A popular NoSQL database used for storing and retrieving data.\n- Mongoose: An Object Data Modeling (ODM) library for MongoDB and Node.js, providing a higher-level abstraction for interacting with the database.\n- JWT (JSON Web Token): A standard for securely transmitting information between parties as a JSON object.\n- bcrypt: A library used for hashing passwords and comparing hashed passwords for authentication.\n- cors: A middleware that enables Cross-Origin Resource Sharing, allowing requests from different origins.\n- dotenv: A module that loads environment variables from a .env file into process.env.\n- Winston: A versatile logging library for Node.js applications.\n- winston-daily-rotate-file: A transport for Winston that rotates log files on a daily basis.\n- zod: A TypeScript-first schema validation library that makes it easy to validate data and ensure its integrity.\n\n### Dev Dependencies\n\n- @types/cors: TypeScript type definitions for the cors module.\n- @types/express: TypeScript type definitions for the express module.\n- eslint-config-prettier: An ESLint configuration that disables formatting rules conflicting with Prettier.\n- husky: A Git hook framework used to run scripts before committing or pushing code.\n- lint-staged: A tool used to run scripts on staged files in Git before committing.\n- prettier: A code formatter that enforces consistent code style.\n- ts-node-dev: A development tool that restarts the server when changes are detected, using TypeScript directly.\n- typescript: A programming language that enables static typing in JavaScript.\n\n# API Routes\n\nThe backend provides the following API routes:\n\n### User Routes\n\n- `GET` /users : Fetches all users from the database.\n- `POST` /users : Creates a new user in the database.\n- `GET` /users/:id : Fetches a user by their ID.\n- `DELETE` /users/:id : Deletes a user by their ID.\n- `PATCH` /users/:id : Updates a user by their ID.\n\n### Book Routes\n\n- `GET` /books : Fetches all books from the database.\n- `POST` /books : Creates a new book in the database.\n- `GET` /books/:id : Fetches a book by its ID.\n- `PATCH` /books/:id : Updates a book by its ID.\n- `DELETE` /books/:id : Deletes a book by its ID.\n- `POST` /books/add-review/:id : Adds a new review to a book.\n- `PATCH` /books/mark-as-read/:id : Adds the user's ID to the readers array of the book.\n\n### Authentication Routes\n\n- `POST` /auth/login: Authenticates a user with their email and password.\n- `POST` /auth/refresh-token: Retrieves a new JWT token and login info based on the cached refresh token.\n\n**Note**: Replace :id with the corresponding ID or parameter in the route.\n\n# Resources\n\n[Frontend Repository](https://github.com/Labib2003/book-catalog-frontend)\n\n[Live Demo](https://book-catalog-backend-one.vercel.app/)\n\n# Conclusion\n\nThank you for reviewing the readme file for the backend part of the Simple Book Catalog Application. For any further assistance or inquiries, please contact the project developers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabib2003%2Fbook-catalog-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabib2003%2Fbook-catalog-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabib2003%2Fbook-catalog-backend/lists"}