Bookly is a high performance FastAPI-based Book API, RESTful web service designed for managing book-related data efficiently and securely. Built using FastAPI, this API enables developers to perform full CRUD operations (Create, Read, Update, Delete) on books and related entities such as authors, genres, and publishers.
Key Features:
- 🚀 Fast & Asynchronous: Powered by FastAPI’s async capabilities for high performance and scalability.
- 🔐 Secure Authentication: Optional JWT-based authentication for protected endpoints.
- 🧾 CRUD Functionality: Endpoints for adding, retrieving, updating, and deleting books.
- 🔍 Search & Filtering: Easily filter books by title, author, genre, or publication year.
- 📦 Modular Design: Clean, modular project structure following best practices for scalability and maintainability.
- 📄 Interactive Docs: Automatically generated Swagger UI and ReDoc for easy API exploration and testing.
Use Cases:
- Digital library systems
- Online bookstores
- Educational apps needing book data
- Inventory tracking for physical book collections
This API serves as a solid foundation for any book-related application, whether you're building a lightweight catalog app or a robust online library system.
🔹 FastAPI — Modern, fast (high-performance) web framework.
🔹 Pydantic - Pydantic is a Python library used for data validation and settings management using Python type annotations.
🔹 SQLModel — Designed to combine the best of SQLAlchemy and Pydantic.
Getting started as a user is easy! 🧑💻
-
Clone the repository:
git clone https://github.com/morikeli/fastapi-sqlmodel.git cd fastapi-sqlmodel -
Install the dependencies:
pip install -r requirements.txt
-
Run the app:
uvicorn app:app --reload
-
Explore the API docs: To access API documentation, visit the following endpoints:
- http://127.0.0.1:8000/docs for a Swagger UI experience! ✨
- http://127.0.0.1:8000/redoc for a Redoc UI experience! ✨
If you're interested in building on top of this or just exploring, here’s how things are set up:
-
Project Structure:
📦project-root │ ├── 📄 app | ├── 📄 core | │ └── 📄 __init__.py | │ └── 📄 config.py # project configuration - get environment variables | ├── 📄 db | │ └── 📄 __init__.py | │ └── 📄 database.py # database configuratiion and connection | ├── 📄 models | │ └── 📄 __init__.py | │ └── 📄 models.py # book model | ├── 📄 routes | │ └── 📄 __init__.py | │ └── 📄 routes.py # routes | ├── 📄 schemas | │ └── 📄 __init__.py | │ └── 📄 book_schemas.py | ├── 📄 services | │ └── 📄 __init__.py | │ └── 📄 book_service.py | ├── 📄 __init__.py # App entry point | ├── 📄 .gitignore ├── 📄 db.sqlite3 # Develpoment database ├── 📄 LICENSE # MIT license ├── 📄 README.md ├── 📄 requirements.txt -
Environment Variables: Create a
.envfile for settings like the database URL if you plan to expand!To use sqlite provided, create a
.envfile and add this environment variable.DATABASE_URL=sqlite+aiosqlite:///./db.sqlite3
Contributions are warmly welcome! 🌟
- Fork the repository
- Create a new branch (
git checkout -b you-branch-name) - Commit your changes (
git commit -m 'feature: Added a cool feature') - Push to the branch (
git push origin your-branch-name) - Open a Pull Request
Please ensure your code is clean and follows FastAPI's and Pydantic’s best practices.
Let’s learn and build together! 🤝
📝 Licensed under the MIT License.
Feel free to use, modify, and distribute!
Made with ❤️ while learning FastAPI + SQLModel.
