A FastAPI-based REST API for managing a library of books, using SQLite for storage and Docker for deployment.
- Clone the repository
- Install dependencies
- For production:
pip install -r requirements.txt
- For development/testing:
pip install -r requirements.txt -r requirements-dev.txt
- For production:
- Database
- To manually create or reset the example database, use the scripts in
database/.
- To manually create or reset the example database, use the scripts in
- Build Docker image:
- Run the VS Code task "Build Docker Container" or:
./bin/build.sh
- Run the VS Code task "Build Docker Container" or:
- Run the API in Docker:
- Run the VS Code task "Run Docker Container" or:
./bin/up.sh
- Run the VS Code task "Run Docker Container" or:
- Stop the Docker container:
- Run the VS Code task "Down Docker Container" or:
./bin/down.sh
- Run the VS Code task "Down Docker Container" or:
- Development dependencies:
- Install from
requirements-dev.txtfor local testing.
- Install from
- Unit tests:
- Run all tests:
python3 -m unittest discover -s test
- Run all tests:
main.py— FastAPI app entry pointapi/— API routes and routersdatabase/— SQLite connector and scriptstest/— Unit and integration testsbin/— Shell scripts for Docker workflow
For more details, see comments in the code and test files.