A comprehensive desktop application for fleet and vehicle management, featuring offline capabilities, bilingual (English/Urdu) support, and financial tracking.
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation & Setup
- Usage Guide
- Distribution
- Troubleshooting
- Desktop Application: Built with Electron for a seamless native Windows experience.
- Offline First: Utilizes SQLite (
better-sqlite3) for local data storage. No internet connection required. - Bilingual Support: Full English & Urdu language toggle with RTL (Right-to-Left) layout and Nastaliq fonts.
- Modules:
- Dashboard: Real-time overview of expenses, trips, and fleet status.
- Vehicle Management: Register and track vehicle details (Plate number, Model, Purchase date).
- Trip Management: Log trips with origin, destination, purpose, and distance.
- Diesel/Fuel Management: Record fuel consumption, costs per liter, and station details.
- Spare Parts Inventory: Track parts, stock levels, and cost prices.
- Cashbook: Record income/expenses, payment modes (Cash/Online/Bank), and generate transaction logs.
- Printing: Built-in print reports for every module (Invoices, History, Inventory lists).
- Data Persistence: All data is stored locally in a local SQLite database file.
- Frontend: React 19.2.3 + TypeScript
- UI Framework: Electron 28.3.0
- Database: SQLite via
better-sqlite3(Native Node.js binding) - Bundler: Webpack 5
- Styles: CSS3 (No external UI libraries used for custom styling)
fleet-manager-app/
βββ src/
β βββ main/ # Electron Main Process (Backend)
β β βββ index.ts # Entry point, window creation
β β βββ database.ts # SQLite table definitions & queries
β β βββ ipc.ts # Inter-Process Communication handlers
β βββ preload/ # Secure Bridge
β β βββ index.ts # Exposes APIs to renderer
β βββ renderer/ # React Frontend (UI)
β βββ App.tsx # Main layout & routing
β βββ LanguageContext.tsx # Language State (English/Urdu)
β βββ translations.ts # Dictionary for all UI text
β βββ components/ # Feature components
β β βββ Dashboard.tsx
β β βββ Vehicles.tsx
β β βββ Trips.tsx
β β βββ Diesel.tsx
β β βββ Transactions.tsx
β β βββ SpareParts.tsx
β βββ index.tsx # React Render entry
β βββ styles/
β βββ App.css # Global Styles & RTL support
βββ dist/ # Compiled JS output (Webpack)
βββ dist-installer/ # Windows Installer (NSIS)
βββ package.json # Dependencies & Scripts
βββ tsconfig.json # TypeScript Config
βββ webpack.config.js # Build Configuration
- Node.js: Version 20 or higher (Electron 28.3.0 uses Node v20).
- Note: If using Node v22, ensure Electron version is compatible or native modules are rebuilt.
- Package Manager: npm (or pnpm).
- Windows Build Tools (Optional): Required if you need to manually compile
better-sqlite3. Pre-built binaries are used by default for version 9.0.0. - Fonts:
Noto Nastaliq Urduis loaded via Google Fonts for Urdu support.
- Clone/Download the project folder.
- Open PowerShell/Terminal in the project root.
- Install Dependencies:
npm install
- Note: This installs React, Electron, TypeScript, and
better-sqlite3.
- Note: This installs React, Electron, TypeScript, and
- Run the Application:
npm start
- This command performs two steps:
- Runs
webpackto bundle React. - Runs
tscto compile the Main process. - Starts Electron.
- Runs
- This command performs two steps:
To distribute the app as an executable with a desktop shortcut:
- Build the Installer:
npm run dist
- Locate Installer:
- Go to the
dist-installerfolder created. - Find
Fleet Manager Pro Setup 1.0.0.exe.
- Go to the
- Install:
- Double-click the
Setup.exe. - Follow the installation wizard.
- A shortcut named "Fleet Manager Pro" will be automatically added to your Desktop.
- Double-click the
- Locate the language button at the top of the Sidebar.
- Click "Ψ§Ψ±Ψ―Ω (Urdu)" to switch to Urdu.
- Click "English" to switch back.
- Effect: The entire interface (Text direction, Fonts, Labels) updates instantly.
- Dashboard: View total vehicle count, total trips, expenses vs income, and cash balance.
- Vehicles:
- Click "Add New Vehicle".
- Enter details (Name, Plate Number, Model).
- Urdu Input: When in Urdu mode, input fields accept Nastaliq script text.
- Trips:
- Log a new trip by selecting a vehicle and entering Origin/Destination.
- History shows detailed list of past trips.
- Diesel:
- Record fuel fills. The total cost is calculated automatically based on
Liters * Price. - Odometer readings help track fuel efficiency.
- Record fuel fills. The total cost is calculated automatically based on
- Spare Parts:
- Manage inventory.
- The system highlights "Low Stock" if quantity falls below the set minimum level.
- Transactions:
- Record Income/Expense.
- Categories: Fuel, Maintenance, Salary, etc.
- Payment Modes: Cash, Online Transaction, Bank Transfer.
- Every module has a "Print Report" button in the top-right corner of the list view.
- Clicking this opens the Windows Print dialog.
- The CSS includes a
@media printblock that automatically hides the sidebar and buttons to produce a clean report.
- Run
npm run dist. - Zip the contents of the
dist-installerfolder. - Send/upload
Fleet Manager Pro Setup 1.0.0.exe. - Users simply download and run it.
If you update the code and create a new installer:
- Run
npm run distagain. - The generated installer will overwrite the old installation.
- (Optional) Uninstall the old version before installing the new one to prevent duplicate icons.
- Cause: The version of
better-sqlite3innode_moduleswas compiled for your system's Node.js (e.g., v22), but Electron uses a different internal Node version (e.g., v20). - Solution:
- Ensure you are using
better-sqlite3version^9.0.0(Stable). - Delete
node_modulesfolder and runnpm install. - Ensure you have a
.npmrcfile withruntime=electronif manually targeting Electron builds.
- Ensure you are using
- Cause:
npm installfailed or wasn't run. - Solution: Run
npm install.
- Cause: Typo in import path or filename mismatch (
translation.tsvstranslations.ts). - Solution: Check
src/renderer/LanguageContext.tsximport path. It must match the filename exactly.
- Cause: Webpack
clean: truedeleted thepreloadfolder, orpreload/index.tsis missing. - Solution:
- Ensure
src/preload/index.tsexists. - Run
npm run build. - Check
dist/preload/index.jswas created.
- Ensure
- Location:
C:\Users\<YourUser>\AppData\Roaming\fleet-manager-app\fleet.db - Backup: To backup your data, simply copy the
fleet.dbfile found in that folder.
ISC