This project features a suite of interconnected services designed to simplify operations involving database management, dynamic content handling, and third-party integrations like WordPress. Powered by FastAPI, the system offers robust APIs for scalable and efficient performance.
- 🌟 Comprehensive Multi-Service System
- Dynamically connects to any database using API-supplied credentials.
- Supports operations like saving, querying, and updating data.
- Handles background tasks for non-blocking performance.
- Automates saving images from a local directory to a MySQL database.
- Optionally uploads images to WordPress via REST API and saves the WordPress URL in the database.
The modular design enables adding new services, such as:
- User Management
- File Processing
- Enhanced Third-Party Integrations
-
Dynamic Database Connections
Flexibly connect to and operate on any database using runtime-provided credentials. -
Image Handling
Batch-process images, save metadata, and optionally upload to WordPress. -
Background Tasks
Use asynchronous operations for faster and non-blocking workflows. -
Error Handling
Robust mechanisms to handle invalid paths, database issues, and API errors. -
Scalability
Designed for extensibility, allowing seamless integration of new services and endpoints.
- Python 3.9+
- MySQL or MariaDB database
- WordPress (for image upload integration)
-
Clone the Repository
git clone https://github.com/your-repo/multi-service-system.git cd multi-service-system
-
Install Dependencies
pip install -r requirements.txt
-
Run Each Server
Start servers usinguvicorn
. Example for Dynamic Image Saver:uvicorn main:main_app --reload
-
Access API Documentation
Navigate to/docs
for interactive API documentation:
Example: http://127.0.0.1:8000/docs
-
POST /save-to-database/
Dynamically connect to a database and save incoming data.Parameters:
- Database credentials (
db_host
,db_port
,db_user
,db_password
,db_name
) - Data to save (JSON)
Response:
- Success or failure message after saving data.
- Database credentials (
-
GET /
Health check endpoint to verify server status. -
POST /save-images-to-database/
Save images and metadata to a database and optionally upload to WordPress.Parameters:
- Directory path containing images.
- Optional WordPress credentials (
wp_api_url
,wp_user
,wp_password
).
Response:
- Success message with details of processed images.
- Uses SQLAlchemy for ORM with MySQL database support.
- Dynamically connects to the database specified in the request.
- Automatically creates tables based on ORM models.
Example Table (Dynamic Image Saver):
CREATE TABLE images (
id INT AUTO_INCREMENT PRIMARY KEY,
file_name VARCHAR(255) NOT NULL UNIQUE,
title VARCHAR(255),
description TEXT,
wp_url VARCHAR(255)
);
The Dynamic Image Saver supports uploading images to WordPress using its REST API.
- Provide the WordPress API endpoint (e.g.,
/wp-json/wp/v2/media
). - Use a valid WordPress username and password for authentication.
- JPEG
- PNG
- GIF
project-root/
│
├── dynamic_database_saver.py # Server for saving data to any database.
├── dynamic_image_saver.py # Server for image handling and saving.
├── requirements.txt # Python dependencies.
├── README.md # Project documentation.
└── ... # Additional services and modules.
-
Authentication and Authorization
Add OAuth2 for secure access to APIs. -
Cloud Storage Integration
Support for AWS S3, Google Cloud Storage, and Azure Blob Storage. -
User Management API
Extend functionality to manage users and roles. -
Custom Query Builder
Provide a user-friendly frontend for building dynamic queries.
- Framework: FastAPI
- Database ORM: SQLAlchemy
- Third-Party Integration: WordPress REST API
💡 Feel free to contribute, suggest features, or report issues!
📧 Contact: [Your Email]