Skip to content

tobangado69/fleettracker-pro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

73 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš› FleetTracker Pro

Comprehensive Driver Tracking SaaS Application for Indonesian Fleet Management

Go Version TypeScript PostgreSQL License

🎯 Overview

FleetTracker Pro is a comprehensive SaaS application designed specifically for Indonesian logistics companies and fleet operators. The platform provides real-time GPS tracking, driver behavior analysis, and operational efficiency through advanced analytics and reporting.

🌟 Key Features

  • πŸ“ Real-Time GPS Tracking - 30-second update intervals with 99.5% accuracy
  • πŸ‘¨β€πŸ’Ό Driver Behavior Monitoring - Comprehensive scoring system (0-100 scale)
  • β›½ Fuel Consumption Analytics - Advanced tracking with IDR cost analysis
  • πŸ—ΊοΈ ETA Prediction & Route Optimization - AI-powered route suggestions
  • πŸ’³ Indonesian Payment Integration - QRIS, GoPay, OVO, DANA support
  • 🌏 Multi-language Support - Bahasa Indonesia & English
  • πŸ“Š Advanced Analytics - Custom reports and compliance tracking

πŸ—οΈ Architecture

Technology Stack

Backend

  • Go (Golang) - High-performance backend with excellent concurrency
  • PostgreSQL 18 - Robust database with PostGIS for geospatial data
  • TimescaleDB - Time-series data optimization for GPS tracking
  • Gin Framework - Lightweight, fast HTTP web framework
  • JWT Authentication - Stateless, scalable authentication

Frontend

  • Vite + TypeScript - Modern build tool with type safety
  • TanStack Query - Powerful server state management
  • Better Auth - Modern authentication with excellent TypeScript support
  • TailwindCSS - Utility-first CSS framework
  • React Leaflet - Interactive maps for fleet visualization

Infrastructure

  • Docker - Containerized deployment
  • Redis - Caching and session storage
  • WebSocket - Real-time GPS updates
  • Indonesian Cloud Providers - Data residency compliance

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚    Backend      β”‚    β”‚   Database      β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ Vite + TS       │◄──►│ Go + Gin        │◄──►│ PostgreSQL 18   β”‚
β”‚ TanStack Query  β”‚    β”‚ JWT Auth        β”‚    β”‚ PostGIS         β”‚
β”‚ Better Auth     β”‚    β”‚ WebSocket       β”‚    β”‚ TimescaleDB     β”‚
β”‚ TailwindCSS     β”‚    β”‚ REST APIs       β”‚    β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
         β”‚              β”‚  External APIs  β”‚             β”‚
         β”‚              β”‚                 β”‚             β”‚
         └─────────────── Google Maps     β”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ QRIS Payment    β”‚
                        β”‚ WhatsApp API    β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/tobangado69/fleettracker-pro.git
    cd fleettracker-pro
  2. Set up environment variables

    # Copy example environment files
    cp backend/.env.example backend/.env
    cp frontend/.env.example frontend/.env
    
    # Edit with your configuration
    nano backend/.env
    nano frontend/.env
  3. Start with Docker Compose (Recommended)

    # Start all services
    docker-compose up -d
    
    # View logs
    docker-compose logs -f
  4. Initialize Database

    cd backend
    
    # Run migrations
    make migrate-up
    
    # Seed database (creates super-admin)
    make seed
    
    # βœ… Super-Admin Credentials:
    # Email: [email protected]
    # Password: ChangeMe123!
    # ⚠️  MUST change password on first login!
  5. Manual Setup (Development)

    # Start database
    docker-compose up -d postgres redis
    
    # Backend setup
    cd backend
    go mod download
    make migrate-up
    make seed
    go run cmd/server/main.go
    
    # Frontend setup (new terminal)
    cd frontend
    npm install
    npm run dev

Access the Application

πŸ” First Login & Setup

FleetTracker Pro uses an invite-only system - there is no public registration for security.

Step 1: Super-Admin Login

# Login with default super-admin credentials
curl -X POST http://localhost:8080/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "ChangeMe123!"
  }'

# Response includes: "must_change_password": true
# Save the access_token

Step 2: Change Password (Required)

# Change password before accessing other features
curl -X PUT http://localhost:8080/api/v1/auth/change-password \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "current_password": "ChangeMe123!",
    "new_password": "YourSecurePassword123!"
  }'

# βœ… Password changed, full access granted

Step 3: Invite Users

# Create company owner (super-admin only)
curl -X POST http://localhost:8080/api/v1/users \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "first_name": "John",
    "last_name": "Doe",
    "role": "owner",
    "company_id": "company-uuid"
  }'

# System generates temporary password and logs it
# User receives invitation (logged to console for now)
# User must change password on first login

User Invitation Flow:

  1. Admin creates user via POST /users (no password = auto-generated)
  2. System generates secure temporary password
  3. Temporary password logged to console (email service TODO)
  4. User logs in with temporary password
  5. User forced to change password
  6. User gains full access after password change

πŸ“š Documentation

πŸ“‚ Documentation Structure (Updated October 10, 2025)

Documentation has been organized by technology stack:

🎯 Quick Links by Role

πŸ“‹ Backend Documentation (βœ… 100% Complete)

🎨 Frontend Documentation (🚧 In Planning)

πŸ”— API & Reference


πŸ“ Project Structure

fleettracker-pro/
β”œβ”€β”€ backend/               # Go backend application (βœ… 100% Complete)
β”‚   β”œβ”€β”€ cmd/server/        # Application entry point
β”‚   β”œβ”€β”€ internal/          # Private application code
β”‚   β”‚   β”œβ”€β”€ auth/          # Authentication service
β”‚   β”‚   β”œβ”€β”€ vehicle/       # Vehicle management
β”‚   β”‚   β”œβ”€β”€ tracking/      # GPS tracking service
β”‚   β”‚   β”œβ”€β”€ driver/        # Driver management
β”‚   β”‚   └── common/        # Shared utilities
β”‚   β”œβ”€β”€ pkg/               # Public library code
β”‚   β”œβ”€β”€ migrations/        # Database migrations
β”‚   └── docs/              # API documentation (Swagger)
β”œβ”€β”€ frontend/              # React frontend application (🚧 In Planning)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ services/      # API service layer
β”‚   β”‚   β”œβ”€β”€ stores/        # State management
β”‚   β”‚   └── types/         # TypeScript type definitions
β”‚   └── public/            # Static assets
β”œβ”€β”€ docs/                  # Project documentation (NEW STRUCTURE)
β”‚   β”œβ”€β”€ backend/           # Backend-specific documentation
β”‚   β”‚   β”œβ”€β”€ PRD.md         # Backend product requirements
β”‚   β”‚   └── technical-implementation-guide.md
β”‚   β”œβ”€β”€ frontend/          # Frontend-specific documentation
β”‚   β”‚   β”œβ”€β”€ PRD.md         # Frontend product requirements
β”‚   β”‚   └── technical-implementation-guide.md
β”‚   └── README.md          # Documentation navigation index
β”œβ”€β”€ specs/                 # SDD specifications (15 features)
β”‚   β”œβ”€β”€ active/            # Active feature briefs
β”‚   └── BACKEND_COMPLETION_STATUS.md
β”œβ”€β”€ docker-compose.yml     # Development environment
β”œβ”€β”€ Dockerfile             # Production container
└── README.md              # This file

πŸ”§ Development

Backend Development

cd backend

# Install dependencies
go mod download

# Run tests
go test ./...

# Run with hot reload (install air first)
go install github.com/cosmtrek/air@latest
air

# Generate API documentation
swag init -g cmd/server/main.go

Frontend Development

cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

# Run tests
npm run test

# Build for production
npm run build

# Type checking
npm run type-check

Database Management

# Run migrations
cd backend
go run cmd/migrate/main.go up

# Create new migration
go run cmd/migrate/main.go create add_new_table

# Rollback migration
go run cmd/migrate/main.go down 1

🌏 Indonesian Market Features

Payment Integration

  • QRIS - Indonesian standardized QR payment
  • Bank Transfer - BCA, Mandiri, BNI, BRI integration
  • E-Wallet - GoPay, OVO, DANA, ShopeePay support

Localization

  • Currency - Indonesian Rupiah (IDR) with proper formatting
  • Language - Bahasa Indonesia with English fallback
  • Timezone - WIB/WITA/WIT support
  • Phone Numbers - Indonesian phone number validation

Compliance

  • Data Residency - All data stored within Indonesia
  • Transportation Regulations - Ministry of Transportation compliance
  • Labor Laws - Driver working hours tracking
  • Privacy Laws - Indonesian data protection compliance

πŸ“Š Performance Targets

  • API Response Time: < 200ms (95th percentile)
  • GPS Data Processing: < 30 seconds
  • Frontend Loading: < 3 seconds
  • Database Queries: Optimized with proper indexing
  • WebSocket Stability: > 99% uptime
  • System Availability: 99.9% SLA

πŸ” Security

Authentication Model

  • Invite-Only System: No public registration - enhanced security for B2B SaaS
  • Super-Admin Seed: Initial administrator created via secure database seed
  • JWT Authentication: Stateless, scalable token-based authentication
  • Force Password Change: Users must change temporary password on first login
  • 5-Tier Role Hierarchy: super-admin β†’ owner β†’ admin β†’ operator β†’ driver
  • Session Management: Track and revoke active sessions

Security Features

  • Multi-Tenant Isolation: Strict company data isolation (100% secure)
  • Data Encryption: AES-256 encryption at rest and in transit
  • Access Control: Role-based access control (RBAC) with privilege escalation prevention
  • Audit Logging: Complete audit trail for all actions
  • Input Validation: 80+ Indonesian-specific validators
  • Rate Limiting: API rate limiting and DDoS protection
  • Temporary Passwords: Crypto-secure random password generation
  • Cache Invalidation: Automatic cache/session invalidation on password change

πŸ§ͺ Testing

# Backend tests
cd backend
go test -v ./...

# Frontend tests
cd frontend
npm run test

# Integration tests
docker-compose -f docker-compose.test.yml up --abort-on-container-exit

# E2E tests
npm run test:e2e

πŸš€ Deployment

Production Deployment

# Build production images
docker build -t fleettracker/backend:latest ./backend
docker build -t fleettracker/frontend:latest ./frontend

# Deploy to Indonesian cloud provider
kubectl apply -f k8s/

# Monitor deployment
kubectl get pods -l app=fleettracker

Environment Configuration

  • Development: Local development with Docker Compose
  • Staging: Staging environment for testing
  • Production: Indonesian cloud deployment with data residency

πŸ“ˆ Monitoring & Observability

  • Metrics: Prometheus + Grafana dashboards
  • Logging: Structured logging with ELK stack
  • Tracing: Distributed tracing with Jaeger
  • Health Checks: Kubernetes health and readiness probes
  • Alerts: Critical system alerts via WhatsApp/SMS

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow Go best practices and conventions
  • Write comprehensive tests for new features
  • Update documentation for API changes
  • Ensure Indonesian market requirements are met
  • Follow security best practices

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Support

πŸ† Success Metrics

Business Impact

  • 25% reduction in fuel consumption within 6 months
  • 30% improvement in delivery time accuracy
  • 20% decrease in vehicle maintenance costs
  • 95% user satisfaction rating
  • 40% reduction in unauthorized vehicle usage

Technical Metrics

  • 99.5% GPS data accuracy
  • 99.9% system uptime
  • <2 second dashboard load time
  • <30 second real-time update latency

Built with ❀️ for Indonesian Fleet Management

FleetTracker Pro - Real-Time Visibility, Data-Driven Insights

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published