System Architecture
Viax is built with a modular monolith architecture that follows Clean Architecture principles, preparing the platform for future scalability and potential migration to microservices.Architecture Overview
Technology Stack
Frontend Technology
- Flutter Framework
- State Management
- UI/UX
Flutter SDK 3.35.3+
- Cross-platform development (iOS & Android)
- Hot reload for rapid development
- Native performance with compiled code
- Rich widget library
- Material Design 3 implementation
Backend Technology
External Services
Mapbox
Maps & Routing
- Map tiles: 100,000/month free
- Directions API: 100,000/month free
- Geocoding API
- Static maps
TomTom
Traffic Data
- Real-time traffic: 2,500/day free
- Route optimization
- ETA calculation
- Traffic flow data
Nominatim
Geocoding
- Address to coordinates
- Reverse geocoding
- Unlimited free tier
- OpenStreetMap data
Gmail SMTP
Email Service
- Email verification
- Password reset
- Notifications
- PHPMailer integration
System Components
Mobile Application (Flutter)
Directory Structure:Authentication Module
Authentication Module
Capabilities:
- User registration with validation
- Email verification (6-digit codes)
- Secure login/logout
- Password reset flow
- Session management
- Passwords hashed with bcrypt
- Email verification required
- Input sanitization
- Secure token storage
Map Integration Module
Map Integration Module
Features:
- Real-time GPS tracking
- Interactive map display
- Marker placement
- Route visualization
- Geocoding/reverse geocoding
- flutter_map for rendering
- geolocator for GPS
- Mapbox API for tiles
- Nominatim for geocoding
Trip Management Module
Trip Management Module
User Flow:
- Select pickup location
- Choose destination
- Select vehicle type
- View price estimate
- Confirm booking
- Track driver
- Complete trip
- Pending (searching driver)
- Accepted (driver assigned)
- In Progress (trip ongoing)
- Completed (finished)
- Cancelled (user/driver cancelled)
Driver Module
Driver Module
Registration:
- Personal information form
- Document upload (license, vehicle)
- Background verification
- Admin approval workflow
- Toggle availability
- View nearby requests
- Accept/decline trips
- Navigate to pickup
- Update location
- Complete trips
Backend API (PHP)
Service Organization:
Example API Response:
Database Schema
Core Entities:- Users
- Drivers
- Trips
- Documents
Deployment Architecture
Production Environment
Current production setup on VPS infrastructure
Development Environment
Local Setup with Laragon:Performance Considerations
Optimization Strategies
Database Indexing
- Primary keys on all tables
- Indexes on foreign keys
- Composite indexes for queries
- Geospatial indexes for location
Caching
- Shared preferences for user data
- In-memory driver location cache
- API response caching
- Static asset caching
Query Optimization
- Prepared statements
- Join optimization
- Limit result sets
- Pagination for large datasets
Asset Optimization
- Compressed images
- Lazy loading
- CDN for static files (future)
- Minified JSON responses
Scalability Path
Current Capacity:- ~1,000 concurrent users
- ~200 active drivers
- ~500 trips per day
-
Vertical Scaling (Short-term)
- Upgrade VPS resources
- Increase database memory
- Optimize queries
-
Horizontal Scaling (Medium-term)
- Load balancer
- Multiple app servers
- Database replication
- Redis for caching
-
Microservices (Long-term)
- Separate services
- Container orchestration
- Message queues
- Service mesh
Security Architecture
Security Layers
Viax’s architecture is designed for reliability, performance, and future growth while maintaining clean code principles and security best practices.