{"id":23703348,"url":"https://github.com/shantanumtk/cpsc_449_book_management_system","last_synced_at":"2026-05-08T17:33:11.160Z","repository":{"id":268477017,"uuid":"904479693","full_name":"Shantanumtk/CPSC_449_Book_Management_System","owner":"Shantanumtk","description":"CPSC 449 Web Backend Engineering Project (Book Management System Backend)","archived":false,"fork":false,"pushed_at":"2024-12-18T02:06:19.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-20T05:17:42.953Z","etag":null,"topics":["fastapi","mysql","pydantic","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Shantanumtk.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-12-17T01:13:56.000Z","updated_at":"2024-12-20T03:19:50.000Z","dependencies_parsed_at":"2024-12-21T20:16:01.474Z","dependency_job_id":null,"html_url":"https://github.com/Shantanumtk/CPSC_449_Book_Management_System","commit_stats":null,"previous_names":["shantanumtk/cpsc_449_book_management_system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shantanumtk%2FCPSC_449_Book_Management_System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shantanumtk%2FCPSC_449_Book_Management_System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shantanumtk%2FCPSC_449_Book_Management_System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shantanumtk%2FCPSC_449_Book_Management_System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shantanumtk","download_url":"https://codeload.github.com/Shantanumtk/CPSC_449_Book_Management_System/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239780142,"owners_count":19695736,"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":["fastapi","mysql","pydantic","python"],"created_at":"2024-12-30T13:01:12.944Z","updated_at":"2026-01-31T04:30:16.614Z","avatar_url":"https://github.com/Shantanumtk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Book Management REST API\n\n## Overview\nThis is a Python-based REST API for managing a book collection, built using FastAPI and MySQL. The API provides endpoints for creating, reading, updating, and deleting books.\n\n## Features\n- Create new books\n- Retrieve all books\n- Retrieve a specific book by ID\n- Update existing book details\n- Delete a book\n\n## Prerequisites\n- Python 3.8+\n- MySQL Database\n- pip (Python package manager)\n- Docker (For containerized deployment)\n- Docker Compose (For easy orchestration)\n\n## Project Structure\n```\nproject_root/\n│\n├── .env             # Environment configuration\n├── .gitignore       # Git ignore file\n├── Dockerfile       # Docker container configuration\n├── docker-compose.yml  # Docker Compose orchestration file\n├── requirements.txt # Project dependencies\n│\n└── app/             # Main application directory\n    ├── main.py      # FastAPI application routes and logic\n    ├── models.py    # SQLAlchemy database models\n    ├── database.py  # Database connection configuration\n    ├── schemas.py   # Pydantic validation schemas\n    └── run.py       # Server startup script\n```\n\n## Installation\n\n### Traditional Installation\n#### 1. Clone the Repository\n```bash\ngit clone https://github.com/Shantanumtk/CPSC_449_Book_Management_System.git\ncd CPSC_449_Book_Management_System/\n```\n\n#### 2. Create a Virtual Environment\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows, use `venv\\Scripts\\activate`\n```\n\n#### 3. Install Dependencies\n```bash\npip install -r requirements.txt\n```\n\n#### 4. Database Setup\n1. Create a MySQL database\n2. Update database connection details in `app/database.py`\n```sql\nCREATE DATABASE book_api;\nUSE book_api;\nCREATE TABLE books (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    title VARCHAR(255) NOT NULL,\n    author VARCHAR(255) NOT NULL,\n    description TEXT\n);\n```\n\n#### 5. Environment Configuration\nCreate a `.env` file with your database credentials:\n```\nMYSQL_USER=mysqluser\nMYSQL_ROOT_PASSWORD=mysqlrootuser\nMYSQL_PASSWORD=mysqluser123\nMYSQL_HOST=mysql-db\nMYSQL_PORT=3306\nMYSQL_DB=bookdb\n```\n\n#### 6. Running the Application\n```bash\npython app/run.py\n```\n\n### Docker Installation\n\n#### Prerequisites\n- Docker installed\n- Docker Compose installed\n\n#### 1. Clone the Repository\n```bash\ngit clone https://github.com/Shantanumtk/CPSC_449_Book_Management_System.git\ncd CPSC_449_Book_Management_System/\n```\n\n#### 2. Build and Run with Docker Compose\n```bash\ndocker compose up --build\n```\n\nThis command will:\n- Build the Docker images for the application and MySQL\n- Start the containers\n- Set up the database\n- Launch the FastAPI application\n\n#### Docker Compose Configuration\nThe `docker-compose.yml` file handles:\n- MySQL database service\n- FastAPI application service\n- Network configuration\n- Volume persistence for database data\n\n#### Stopping the Containers\n```bash\ndocker compose down --volumes\n```\n\n## Running the Application\n\n### Traditional Method\n```bash\npython app/run.py\n```\n\n### Docker Method\n```bash\ndocker compose up \n```\n\n## API Endpoints\n### Create a Book\n- **URL**: `POST http://0.0.0.0:5000/books/`\n- **Request Body**:\n```json\n{\n  \"title\": \"To Kill a Mockingbird\",\n  \"author\": \"Harper Lee\",\n  \"description\": \"A classic novel.\"\n}\n```\n\n### Get All Books\n- **URL**: `GET http://0.0.0.0:5000/books/`\n- **Response**: List of all books\n\n### Get Book by ID\n- **URL**: `GET http://0.0.0.0:5000/books/{book_id}`\n- **Example**: `http://0.0.0.0:5000/books/1`\n\n### Update a Book\n- **URL**: `PUT http://0.0.0.0:5000/books/{book_id}`\n- **Request Body**:\n```json\n{\n  \"title\": \"Updated Title\",\n  \"author\": \"Updated Author\",\n  \"description\": \"Updated description\"\n}\n```\n\n### Delete a Book\n- **URL**: `DELETE http://0.0.0.0:5000/books/{book_id}`\n- **Example**: `http://0.0.0.0:5000/books/1`\n\n## Error Handling\n- 404 Not Found: When a book with the specified ID doesn't exist\n- 400 Bad Request: For invalid input data\n\n## File Descriptions\n### `app/main.py`\nContains the FastAPI application routes and main application logic for book operations.\n\n### `app/models.py`\nDefines SQLAlchemy database models representing the structure of database tables.\n\n### `app/database.py`\nManages database connection configuration and session management.\n\n### `app/schemas.py`\nDefines Pydantic schemas for request and response validation.\n\n### `app/run.py`\nProvides the startup script for running the FastAPI application.\n\n### Additional Docker Files\n### `Dockerfile`\nDefines the Docker image configuration for the Python FastAPI application.\n\n### `docker-compose.yml`\nOrchestrates the multi-container Docker application, defining services, networks, and volumes.\n\n### `requirements.txt`\nLists all Python package dependencies for the project.\n\n## Notes for Docker Usage\n- Ensure Docker and Docker Compose are installed\n- The first run might take some time to download and build images\n- Database data is persisted using Docker volumes\n- Modify `.env` or `docker-compose.yml` for custom configurations\n\nProject Link: https://drive.google.com/file/d/1JykCm3Wk_eEm8F_OJL9NERu62H8MjE-Q/view?usp=drive_link\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshantanumtk%2Fcpsc_449_book_management_system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshantanumtk%2Fcpsc_449_book_management_system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshantanumtk%2Fcpsc_449_book_management_system/lists"}