🚀 A professional Flask-based REST API for managing a mechanic shop, built using the Application Factory Pattern. Features robust error handling, input validation, and comprehensive documentation.
Features • Installation • API Reference • Examples • License
🔹 Modern Architecture
- RESTful API design principles
- Application Factory Pattern for scalability
- Modular codebase organization
🔹 Robust Backend
- SQLite database with SQLAlchemy ORM
- Comprehensive input validation
- Professional error handling
🔹 Advanced Functionality
- Smart pagination for list endpoints
- Powerful search capabilities
- Real-time data validation
🔹 Developer Experience
- Clear documentation
- Easy-to-use endpoints
- Consistent API responses
GET /api/v1/health - System health statusGET /api/v1/mechanics # List all mechanics
POST /api/v1/mechanics # Create a new mechanic
GET /api/v1/mechanics/<id> # Get mechanic details
PUT /api/v1/mechanics/<id> # Update mechanic details
DELETE /api/v1/mechanics/<id> # Delete a mechanic
GET /api/v1/mechanics/search # Search mechanicsGET /api/v1/services # List all services
POST /api/v1/services # Create a new service
GET /api/v1/services/<id> # Get service details
PUT /api/v1/services/<id> # Update service details
DELETE /api/v1/services/<id> # Delete a service
GET /api/v1/services/search # Search services- Python 3.9 or higher
- Git
- pip (Python package installer)
1️⃣ Clone the repository
git clone https://github.com/Anon23261/Module1Lesson4-Specialization.git
cd Module1Lesson4-Specialization2️⃣ Set up virtual environment
python -m venv venv
# On Linux/macOS:
source venv/bin/activate
# On Windows:
venv\Scripts\activate3️⃣ Install dependencies
pip install -r requirements.txt4️⃣ Initialize database
python init_db.py5️⃣ Start the server
python run.py🌟 The API will be available at http://localhost:5000
Click to expand
curl -X POST -H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"email": "john.smith@mechanic.com",
"specialty": "Engine Repair",
"certification": "ASE Master Technician",
"years_experience": 10
}' \
http://localhost:5000/api/v1/mechanics{
"id": 1,
"name": "John Smith",
"email": "john.smith@mechanic.com",
"specialty": "Engine Repair",
"certification": "ASE Master Technician",
"years_experience": 10,
"created_at": "2025-02-13T22:57:31.450566",
"updated_at": "2025-02-13T22:57:31.450574"
}Click to expand
curl -X POST -H "Content-Type: application/json" \
-d '{
"name": "Engine Tune-up",
"description": "Complete engine tune-up service",
"price": 299.99,
"duration_hours": 2.5,
"mechanic_id": 1
}' \
http://localhost:5000/api/v1/services{
"id": 1,
"name": "Engine Tune-up",
"description": "Complete engine tune-up service",
"price": 299.99,
"duration_hours": 2.5,
"mechanic_id": 1,
"created_at": "2025-02-13T22:57:40.902592",
"updated_at": "2025-02-13T22:57:40.902597"
}📦 mechanic_shop
┣ 📂 app
┃ ┣ 📂 models
┃ ┃ ┣ 📜 __init__.py
┃ ┃ ┣ 📜 mechanic.py
┃ ┃ └ 📜 service.py
┃ ┣ 📂 routes
┃ ┃ ┣ 📜 __init__.py
┃ ┃ ┣ 📜 mechanic.py
┃ ┃ └ 📜 service.py
┃ ┣ 📂 utils
┃ ┃ ┣ 📜 __init__.py
┃ ┃ ┣ 📜 error_handlers.py
┃ ┃ └ 📜 validators.py
┃ ┣ 📜 __init__.py
┃ ┣ 📜 extensions.py
┃ └ 📜 config.py
┣ 📜 requirements.txt
┣ 📜 run.py
┣ 📜 init_db.py
┣ 📜 LICENSE
└ 📜 README.md
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Anon23261
