{"id":25171455,"url":"https://github.com/basemax/fastapibooks","last_synced_at":"2025-05-05T20:45:46.046Z","repository":{"id":166336003,"uuid":"626504041","full_name":"BaseMax/FastAPIBooks","owner":"BaseMax","description":"A REST API built with Python and FastAPI, integrating with MongoDB for CRUD operations (Create, Read, Update, Delete) on books. FastAPI is a powerful web framework for building APIs, while MongoDB is a NoSQL database that provides flexibility and scalability.","archived":false,"fork":false,"pushed_at":"2025-04-26T06:51:35.000Z","size":82,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-04T21:45:38.315Z","etag":null,"topics":["api","fastapi","py","python","restful","restful-api","webservice","webservice-endpoints","webservices"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-04-11T15:43:03.000Z","updated_at":"2025-04-26T06:51:33.000Z","dependencies_parsed_at":"2023-06-27T00:26:02.002Z","dependency_job_id":"7debfafe-0326-4f2a-84f3-6d77612ba116","html_url":"https://github.com/BaseMax/FastAPIBooks","commit_stats":{"total_commits":27,"total_committers":4,"mean_commits":6.75,"dds":0.5925925925925926,"last_synced_commit":"4e14504d7715c10e23b1459c58ae1f9408c5b833"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FFastAPIBooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FFastAPIBooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FFastAPIBooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FFastAPIBooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/FastAPIBooks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252574495,"owners_count":21770414,"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","fastapi","py","python","restful","restful-api","webservice","webservice-endpoints","webservices"],"created_at":"2025-02-09T09:20:30.190Z","updated_at":"2025-05-05T20:45:46.025Z","avatar_url":"https://github.com/BaseMax.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Books Fast-API\n\nThis is an advanced REST API built with Python and FastAPI, integrating with MongoDB for CRUD operations (Create, Read, Update, Delete) on books. FastAPI is a powerful web framework for building APIs, while MongoDB is a NoSQL database that provides flexibility and scalability.\n\n## Routes\n\n| HTTP Method | Endpoint              | Description          |\n|-------------|-----------------------|----------------------|\n| GET         | /books                | Get all books        |\n| GET         | /books/{book_id}      | Get a specific book  |\n| POST        | /books                | Add a new book       |\n| PUT         | /books/{book_id}      | Update a book        |\n| DELETE      | /books/{book_id}      | Delete a book        |\n\n## Installation\n\nClone this repository to your local machine:\n\n```bash\ngit clone https://github.com/BaseMax/FastAPIBooks\n```\n\nChange into the project directory:\n\n```bash\ncd FastAPIBooks\n```\nCreate and activate a virtual environment:\n\n```bash\npython -m venv venv\nsource venv/bin/activate\n```\n\nInstall the project dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\nConfigure the `.env` file with your own **MongoDB** credentials:\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env` with your own values:\n\n```ini\nMONGO_URI=\u003cyour-mongodb-uri\u003e\n```\n\nRun the application:\n\n```bash\nuvicorn main:app --reload\n```\n\nThe application will start and be available at http://localhost:8000.\n\n## API Endpoints\n\nRetrieve a list of books:\n```http\nGET /books\n```\n\nReturns a list of all books in the system:\n\n```console\ncurl http://localhost:8000/books/ -H \"Accept: application/json\"\n```\n\nRetrieve details for a specific book:\n\n```http\nGET /books/{book_id}\n```\n\nReturns details for a specific book with the given book_id:\n\n```console\ncurl http://localhost:8000/books/1 -H \"Accept: application/json\"\n```\n\nAdd a new book:\n\n```http\nPOST /books\n```\n\nAdds a new book to the system. The request body should include a **JSON** object with the following properties:\n\n- `title` (string, required): the title of the book\n- `author` (string, required): the author of the book\n- `description` (string): the description of the book\n- `published_year` (integer): the published year of the book\n- `publisher` (string): the publisher of the book\n\n```console\ncurl -X POST http://localhost:8000/books/\n   -H 'Content-Type: application/json'\n   -d '{\"title\":\"The Lord of the Rings\", \"author\": \"J.R.R. Tolkien\", \"published_year\": 1954, \"publisher\": \"George Allen \u0026 Unwin\", \"description\": \"A hobbit named Frodo Baggins and his companions set out on a quest to destroy the One Ring and defeat the dark lord Sauron.\"}'\n```\n\nUpdate an existing book:\n\n```http\nPUT /books/{book_id}\n```\n\nUpdates an existing book with the given `book_id`. The request body should include a **JSON** object with the following properties:\n\n- `title` (string): the new title for the book\n- `author` (string): the new author for the book\n- `description` (string): the new description for the book\n- `published_year` (integer): the new published year for the book\n- `publisher` (string): the new publisher for the book\n\n```console\ncurl -X PUT http://localhost:8000/books/1\n     -H \"Accept: application/json\"\n     -d '{\"title\": \"The Fellowship of the Ring\", \"author\": \"J.R.R. Tolkien\", \"published_year\": 1954, \"publisher\": \"George Allen \u0026 Unwin\", \"description\": \"Epic quest to destroy powerful Ring, facing dark forces.\"}'\n```\n\n## Tests\nyou can run unit tests by the following command:\n\n```console\npytest test_bookAPI.py\n```\nAnd result look like this:\n\n![Screenshot from 2023-04-18 07-01-27](https://user-images.githubusercontent.com/107758775/232664599-36766e55-a93b-4826-bd15-62cfbaa2eeb4.png)\n\n\n## Authors\n\n- Ali Ahmadi\n- Max Base\n\nCopyright 2023, Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Ffastapibooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Ffastapibooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Ffastapibooks/lists"}