Skip to main content

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 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
Key Dependencies:

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:
Key Modules:
Capabilities:
  • User registration with validation
  • Email verification (6-digit codes)
  • Secure login/logout
  • Password reset flow
  • Session management
Security:
  • Passwords hashed with bcrypt
  • Email verification required
  • Input sanitization
  • Secure token storage
Features:
  • Real-time GPS tracking
  • Interactive map display
  • Marker placement
  • Route visualization
  • Geocoding/reverse geocoding
Technologies:
  • flutter_map for rendering
  • geolocator for GPS
  • Mapbox API for tiles
  • Nominatim for geocoding
User Flow:
  1. Select pickup location
  2. Choose destination
  3. Select vehicle type
  4. View price estimate
  5. Confirm booking
  6. Track driver
  7. Complete trip
States:
  • Pending (searching driver)
  • Accepted (driver assigned)
  • In Progress (trip ongoing)
  • Completed (finished)
  • Cancelled (user/driver cancelled)
Registration:
  • Personal information form
  • Document upload (license, vehicle)
  • Background verification
  • Admin approval workflow
Operations:
  • Toggle availability
  • View nearby requests
  • Accept/decline trips
  • Navigate to pickup
  • Update location
  • Complete trips

Backend API (PHP)

Service Organization:
API Design Principles:
1

RESTful Endpoints

Standard HTTP methods (GET, POST, PUT, DELETE) with resource-based URLs
2

JSON Responses

Consistent JSON format with success/error indicators and data payload
3

Error Handling

Structured error responses with codes, messages, and debugging info
4

Security

Input validation, SQL injection prevention, and authentication checks
Example API Response:

Database Schema

Core Entities:
Relationships:

Deployment Architecture

Production Environment

Current production setup on VPS infrastructure
Deployment Flow:
1

Code Preparation

2

Database Migration

3

Permissions

4

Service Restart

5

Health Check

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
Scaling Options:
  1. Vertical Scaling (Short-term)
    • Upgrade VPS resources
    • Increase database memory
    • Optimize queries
  2. Horizontal Scaling (Medium-term)
    • Load balancer
    • Multiple app servers
    • Database replication
    • Redis for caching
  3. Microservices (Long-term)
    • Separate services
    • Container orchestration
    • Message queues
    • Service mesh

Security Architecture

Security measures implemented to protect user data and system integrity

Security Layers

Viax’s architecture is designed for reliability, performance, and future growth while maintaining clean code principles and security best practices.