Vehicle tracking, invoicing with aging analysis, maintenance scheduling, timesheet management, and RBAC — built for Curve Genaral Transport LLC operations in the UAE.
Fleet inventory, registration, assignments, mileage, and availability status tracking.
Create invoices, track payments, 5-bucket aging analysis, VAT at 5% AED.
Schedule service, track costs, link records to vehicles and equipment.
Itemized quotes with approval workflow. Convert approved estimates to invoices.
Thin Capacitor shell connecting to a full Next.js 16 web application. All data and logic server-side.
graph TB
AND[Android App - 4.0 MB] --> SHELL[HTML Shell + Loader]
IOS[iOS App - 642 KB] --> SHELL
SHELL --> CHECK{Online?}
CHECK -->|Yes| PORTAL[Next.js 16 Portal at cgt.llc]
CHECK -->|No| OFFLINE[Offline Panel + Retry]
OFFLINE -->|Reconnect| CHECK
PORTAL --> NAUTH[NextAuth v5]
NAUTH --> RBAC[RBAC: 5 Roles, 36 Permissions]
RBAC --> MODULES[16 Modules]
MODULES --> PRISMA[Prisma ORM - 26 Models]
PRISMA --> NEON[PostgreSQL on Neon]
PORTAL --> VERCEL[Vercel fra1]
MODULES --> SWR[SWR Data Fetching]
MODULES --> PDF[html2canvas + jspdf]
style AND fill:#1B3A5C,stroke:#2a5280,color:#fff
style IOS fill:#1B3A5C,stroke:#2a5280,color:#fff
style SHELL fill:#1B3A5C,stroke:#F47920,color:#fff
style PORTAL fill:#1B3A5C,stroke:#F47920,color:#fff
style OFFLINE fill:#7f1d1d,stroke:#ef4444,color:#fff
style NEON fill:#1a2520,stroke:#22c55e,color:#fff
style VERCEL fill:#1a2520,stroke:#22c55e,color:#fff
flowchart TD
A[Open FleetOps App] --> B[Splash Screen - Navy, 2s]
B --> C[Show Connecting Spinner]
C --> D{navigator.onLine?}
D -->|Yes| E[Fetch app.cgt.llc]
D -->|No| F[Show Offline Panel]
E --> G{Response OK?}
G -->|Yes| H[Redirect to Portal]
G -->|No| F
F --> I[Show 4 Feature Icons]
I --> J[Retry Button]
J --> D
H --> K[NextAuth Login Screen]
K --> L[Enter Email + Password]
L --> M{Valid Credentials?}
M -->|Yes| N[JWT Session Created]
M -->|No| O[Error Message]
O --> L
N --> P[Dashboard with Role-Filtered Sidebar]
style A fill:#1B3A5C,stroke:#F47920,color:#fff
style P fill:#1B3A5C,stroke:#F47920,color:#fff
style F fill:#7f1d1d,stroke:#ef4444,color:#fff
style O fill:#7f1d1d,stroke:#ef4444,color:#fff
| Password | Role | |
|---|---|---|
| Contact your administrator for login credentials | ||
Static panel showing 4 feature icons: Vehicles, Operators, Invoices, Maintenance. Retry button + auto-reconnect on online event. No business data available offline.
graph LR
DASH[Dashboard] --> FLEET[Fleet]
DASH --> FINANCE[Finance]
DASH --> OPS[Operations]
DASH --> GROWTH[Growth]
FLEET --> VEH[Vehicles]
FLEET --> EQUIP[Equipment]
FLEET --> MAINT[Maintenance]
FINANCE --> EST[Estimates]
FINANCE --> INV[Invoices]
FINANCE --> TS[Timesheets]
FINANCE --> RECV[Receivables]
FINANCE --> RC[Rate Cards]
OPS --> CLI[Clients]
OPS --> HR[HR]
OPS --> COMMS[Comms]
OPS --> DOCS[Documents]
GROWTH --> MKT[Marketing Leads]
GROWTH --> MKTPL[Marketplace]
GROWTH --> RPT[Reports]
style DASH fill:#1B3A5C,stroke:#F47920,color:#fff
style FLEET fill:#1a3355,stroke:#3b82f6,color:#fff
style FINANCE fill:#1a3355,stroke:#3b82f6,color:#fff
style OPS fill:#1a3355,stroke:#3b82f6,color:#fff
style GROWTH fill:#1a3355,stroke:#3b82f6,color:#fff
Vehicles, equipment profiles, mileage, assignments, availability status, public registration endpoint.
Estimates with approval, invoices with aging, timesheets, receivables, rate cards. VAT at 5% AED.
Client management, HR records, communications log, document storage and management.
Marketing leads and conversion tracking, marketplace listings, performance reports and analytics.
flowchart TD
A[New Estimate] --> B[Select Client]
B --> C[Add Line Items]
C --> D[Equipment + Rate + Qty + Price]
D --> E[Apply Discount]
E --> F[Auto-calc VAT at 5% AED]
F --> G{Action}
G -->|Save| H[Draft Estimate]
G -->|Submit| I[Pending Approval]
I --> J{Approved?}
J -->|Yes| K[Approved Estimate]
J -->|No| L[Rejected]
L --> C
K --> M{Convert?}
M -->|Yes| N[Create Linked Invoice]
M -->|No| O[Archive]
N --> P[Invoice with Snapshot Fields]
P --> Q[Track Payments]
Q --> R[Aging Buckets: Current to 90+]
P --> S[Share: PDF Export]
style A fill:#1B3A5C,stroke:#F47920,color:#fff
style K fill:#166534,stroke:#22c55e,color:#fff
style L fill:#7f1d1d,stroke:#ef4444,color:#fff
style N fill:#1e3a5f,stroke:#3b82f6,color:#fff
| Bucket | Days | Color |
|---|---|---|
| Current | 0 | Green |
| 1-30 | 1 to 30 | Yellow |
| 31-60 | 31 to 60 | Orange |
| 61-90 | 61 to 90 | Red |
| 90+ | Over 90 | Purple |
Aging recalculated on every read — not stored in DB.
Invoices store clientNameSnapshot and clientAddressSnapshot at creation. Preserves details even if client info changes later.
Every API route calls requireAuth before processing. Sidebar items filtered by role.
flowchart TD
REQ[API Request] --> MW[Middleware Check]
MW --> AUTH{Authenticated?}
AUTH -->|No, API| ERR1[401 JSON Response]
AUTH -->|No, Page| ERR2[Redirect to Login]
AUTH -->|Yes| PERM{Has Permission?}
PERM -->|Yes| EXEC[Execute Route Handler]
PERM -->|No| ERR3[403 Forbidden]
EXEC --> SIDEBAR[Filter Sidebar by Role]
style REQ fill:#1B3A5C,stroke:#F47920,color:#fff
style EXEC fill:#166534,stroke:#22c55e,color:#fff
style ERR1 fill:#7f1d1d,stroke:#ef4444,color:#fff
style ERR2 fill:#7f1d1d,stroke:#ef4444,color:#fff
style ERR3 fill:#7f1d1d,stroke:#ef4444,color:#fff
| Role | Key Access |
|---|---|
| Admin | Full access to all 36 permissions, user management, settings |
| Accounts | Create and edit estimates + invoices, manage timesheets, view others |
| Operations | Edit equipment, manage maintenance + timesheets, view finance |
| Sales | Edit clients + marketing, create estimates, view invoices + equipment |
| Viewer | Read-only: clients, equipment, estimates, invoices, reports |
module:action — e.g. invoices:createrequireAuth in every route handlerNAV_PERMISSION_MAP filters sidebarsrc/lib/permissions.ts
flowchart TD
APP[FleetOps Mobile] --> CGT[app.cgt.llc]
CGT --> NEXT[Next.js 16 + React 19]
NEXT --> API[26 API Route Directories]
API --> PRISMA[Prisma ORM - 26 Models]
PRISMA --> NEON[PostgreSQL on Neon]
NEXT --> NAUTH[NextAuth v5]
NAUTH --> JWT[JWT Sessions]
NEXT --> TW[Tailwind v4 + Radix UI]
NEXT --> CHARTS[Recharts]
API --> SWR[SWR Client Fetching]
API --> PUBLIC[2 Public Endpoints]
style APP fill:#1B3A5C,stroke:#F47920,color:#fff
style NEON fill:#1a2520,stroke:#22c55e,color:#fff
style CGT fill:#1B3A5C,stroke:#F47920,color:#fff
style NEXT fill:#1a3355,stroke:#3b82f6,color:#fff
| Component | Detail |
|---|---|
| Framework | Next.js 16, App Router, TypeScript |
| UI | React 19, Radix UI, Tailwind CSS v4 |
| ORM | Prisma, 26 models |
| Database | PostgreSQL on Neon |
| Auth | NextAuth v5, credentials provider |
| Charts | Recharts |
| Data Fetching | SWR with manual mutate |
| PDF Export | html2canvas + jspdf |
| Hosting | Vercel, fra1 region |
| Code | Language | Direction | Font |
|---|---|---|---|
| EN | English | LTR | System default |
| AR | Arabic | RTL | Noto Sans Arabic |
| TR | Turkish | LTR | System default |
| RU | Russian | LTR | System default |
| UR | Urdu | RTL | Noto Sans Arabic |
Stored in localStorage('fleetops-locale'). RTL auto-switches document direction and font.
| ? | Open shortcuts help modal |
| Alt+N | Open quick create menu |
flowchart TD
A[User Selects Language] --> B{RTL?}
B -->|AR or UR| C[Set dir to RTL]
B -->|EN, TR, RU| D[Set dir to LTR]
C --> E[Load Noto Sans Arabic]
D --> F[System Font]
E --> G[Save to localStorage]
F --> G
G --> H[Reload Interface Text]
style A fill:#1B3A5C,stroke:#F47920,color:#fff
style C fill:#5c4a1e,stroke:#be9a5f,color:#fff
| Limitation | Impact | Workaround |
|---|---|---|
| Online-only | No offline data. Static shell only without internet. | Auto-reconnect on online event; retry button |
| No push notifications | No alerts for overdue invoices, maintenance, or assignments | Dashboard aging colors highlight overdue items |
| PDF quality varies | html2canvas renders at screen resolution | Use tablet or desktop for higher-resolution exports |
| Neon connection pool | Free tier limits concurrent DB connections | Coordinate peak usage; upgrade Neon plan if needed |
| Domain-locked | WebView restricted to cgt.llc only | External links open in device browser |
| iOS unsigned | IPA needs Apple Developer account for distribution | TestFlight or direct install on provisioned devices |
| No real-time sync | Other users changes need manual refresh | SWR revalidates on focus; manual refresh available |
Vehicles, operators, maintenance, timesheets — complete fleet operations platform for UAE.
5 roles, 36 permissions, module:action pattern. API + UI enforcement on every request.
5-bucket invoice aging, VAT at 5% AED, estimate-to-invoice conversion, payment tracking.