This project implements a dynamic CRUD endpoint creator for web applications using FastAPI. It allows easily creating CRUD (Create, Read, Update, Delete) operations for different data entities efficiently and scalably.
- Modular Design: Uses modular classes and functions to dynamically generate CRUD routes.
- Data Validation: Utilizes Pydantic to define data schemas and validate inputs and outputs.
- Exception Handling: Implements structured exception handling to ensure consistent and appropriate responses to errors.
- Secure Transactions: Manages database transactions securely with SQLAlchemy.
- Monitoring and Control: Uses asynchronous functions and supervision to optimize CRUD operation performance.
- Python 3.7 or higher
- Dependencies listed in
requirements.txt
-
Clone this repository:
git clone https://github.com/charlyperezk/router_manager cd router_manager
-
Install dependencies:
pip install -r requirements.txt
-
Configure db:
- Ensure you have an SQLite database or modify examples/database.py to suit your database environment.
-
Run the application:
uvicorn main:app
The application will be available in http://localhost:8000
To add new CRUD entities:
- Define the schemas and database model.
- Instantiate Entity with the objects created in step 1.
- Now you can create your GenericCrud instance for database operations.
- Create your RouteManager object.
- Add your CRUD router to your FastAPI object, using the crud_route property of your RouteManager object.
Contributions are welcome! If you want to improve this project, please send a pull request. If you encounter any issues, please create an issue.
This project is licensed under the MIT License.