π± Flutter App (Frontend)
π Python FastAPI Backend
β (Excel Processing + Business Logic)
π Pandas/OpenPyXL (Excel Handling)
β (Data Validation & Transformation)
ποΈ Hive Database (Local Storage)
This implementation follows your requested architecture with:
- Flutter for cross-platform frontend
- Python FastAPI for robust backend APIs
- Pandas/OpenPyXL for powerful Excel processing
- Hive-style JSON storage for local database
# Double-click to run
start_backend.batOr manually:
cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python main.pyThe backend will start on http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/api/health
# Double-click to run (in a separate terminal)
start_frontend.batOr manually:
flutter pub get
flutter run -d windowsFleetManagementSystem/
βββ backend/ # Python FastAPI Backend
β βββ app/
β β βββ core/
β β β βββ config.py # Configuration & settings
β β βββ database/
β β β βββ hive_manager.py # Hive-style JSON database
β β βββ models/
β β β βββ schemas.py # Pydantic models
β β βββ routes/
β β β βββ vehicles.py # Vehicle CRUD APIs
β β β βββ drivers.py # Driver CRUD APIs
β β β βββ trips.py # Trip management APIs
β β β βββ fuel.py # Fuel entry APIs
β β β βββ maintenance.py # Maintenance APIs
β β β βββ excel_import.py # Excel processing APIs
β β βββ services/
β β βββ excel_service.py # Pandas/OpenPyXL service
β βββ main.py # FastAPI application
β βββ requirements.txt # Python dependencies
βββ lib/ # Flutter Frontend
β βββ services/
β β βββ api_service.dart # HTTP client for backend
β βββ main.dart # Flutter entry point
β βββ app.dart # Main app widget
βββ pubspec.yaml # Flutter dependencies (cleaned)
βββ start_backend.bat # Backend startup script
βββ start_frontend.bat # Frontend startup script
Following your rule, the Hive database is stored at:
C:\Users\{USERNAME}\Documents\fleetManagementSystem\
Database files:
vehicles.jsondrivers.jsontrips.jsonfuel_entries.jsonmaintenance.json- And more...
- β RESTful APIs for all entities
- β Automatic API documentation (Swagger)
- β Data validation with Pydantic
- β Excel import/export with Pandas
- β File-based JSON database (Hive-style)
- β CORS enabled for Flutter communication
- β Comprehensive error handling
- β Modern Material 3 UI
- β Riverpod state management
- β HTTP client (Dio) with interceptors
- β Cross-platform compatibility
- β Clean architecture separation
- β Minimal dependencies
- β Smart sheet detection
- β Automatic field mapping
- β Data validation & transformation
- β Batch import/export
- β Error reporting
GET/POST/PUT/DELETE /api/v1/vehicles/GET/POST/PUT/DELETE /api/v1/drivers/GET/POST/PUT/DELETE /api/v1/trips/GET/POST /api/v1/fuel/GET/POST /api/v1/maintenance/
POST /api/v1/excel/analyze- Analyze Excel file structurePOST /api/v1/excel/import- Import Excel dataGET /api/v1/excel/export- Export data to ExcelGET /api/v1/excel/database/stats- Database statistics
GET /api/health- Health checkPOST /api/v1/excel/database/clear/{table}- Clear table data
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000flutter pub get
flutter run -d windowsVisit http://localhost:8000/docs for interactive API documentation.
- Separation of Concerns: Clear separation between UI, business logic, and data
- Excel Powerhouse: Pandas provides industrial-strength Excel processing
- Local Storage: No need for external database servers
- API-Driven: RESTful APIs make the backend reusable
- Cross-Platform: Flutter works on desktop, mobile, and web
- Type Safety: Pydantic ensures data validation
- Documentation: Auto-generated API docs
- Minimal Setup: Few dependencies, easy to deploy
Edit backend/app/core/config.py:
class Settings:
DEBUG: bool = True
PORT: int = 8000
HIVE_DB_PATH: str = "C:\\Users\\{username}\\Documents\\fleetManagementSystem"Edit lib/services/api_service.dart:
static const String _baseUrl = 'http://localhost:8000/api/v1';The architecture is fully implemented and ready to use. You can now:
- Run the backend with
start_backend.bat - Run the frontend with
start_frontend.bat - Import Excel data using the Excel Import tab
- Manage vehicles, drivers, trips through the API
- View data in the Hive database files
The system follows your requested architecture exactly and provides a solid foundation for fleet management operations!
- Port 8000 in use: Change port in
config.py - Python not found: Install Python 3.8+
- Dependencies fail: Try
pip install --upgrade pip
- Flutter not found: Install Flutter SDK
- Dependency conflicts: Run
flutter clean && flutter pub get - Backend not responding: Ensure backend is running on localhost:8000
- Permission denied: Check Windows folder permissions
- Data not saving: Check the Hive directory path in config