A massively scalable, multi-role Android application powered by Cloudflare's serverless edge computing and D1 SQLite.
Bridging the gap between technicians, shop managers, and customers with sub-millisecond edge latency.
TechFix is a comprehensive, enterprise-grade mobile platform designed to orchestrate the entire lifecycle of device repairs. Built natively for Android, the application eliminates operational bottlenecks using an ultra-fast, serverless backend via Cloudflare Workers and D1 (SQLite at the Edge).
From real-time geospatial routing of customer requests to multi-tier Role-Based Access Control (RBAC), inventory management, and robust financial reporting, TechFix brings modern edge-computing architecture to technical repair chains.
- π Algorithmic Geospatial Auto-Routing: Integrates the Haversine formula on the backend to dynamically calculate the distance from a customer's GPS coordinates to all active branches. Automatically assigns repairs to the nearest branch with available technicians and required spare parts.
- β‘ Global Edge-Native Speed: APIs are executed globally within milliseconds of the end user via Cloudflare Workers. Database queries are distributed and optimized using Cloudflare D1.
- π‘οΈ Zero-Trust Security & RBAC: Features auto-generated secure credentials for new staff, forced mandatory password resets upon first login, and strict RBAC enforced via stateless JWTs verified at the edge.
- πΈ Cloud-Native Media Storage: Seamless integration with Cloudinary for uploading and tracking device condition images, pre-repair, and post-repair photographic evidence.
- π‘ Offline-Ready Mobile Architecture: Built with modern Android standards utilizing Room Database for intelligent local caching, ensuring technicians can view their tasks even with spotty connectivity.
TechFix embraces an Edge-First Architecture. By distributing backend logic directly on Cloudflare's CDN edge nodes, the app guarantees high availability and minimal latency for data-heavy operations.
graph TD
%% Entities
APP[π± Android Native App<br>Retrofit / Java]
EDGE[β‘ Cloudflare Worker<br>Serverless REST API<br>Geospatial Algorithm]
D1[(ποΈ Cloudflare D1<br>Edge SQLite Database)]
CLOUDINARY[βοΈ Cloudinary API<br>Image & Object Storage]
%% Relationships
APP -- "JSON via HTTPS" --> EDGE
EDGE -- "SQL Transactions" --> D1
APP -- "Multipart Upload" --> CLOUDINARY
EDGE -- "Signed Tokens" --> CLOUDINARY
%% Styling
classDef mobile fill:#3DDC84,stroke:#fff,stroke-width:2px,color:#000
classDef cf fill:#F38020,stroke:#fff,stroke-width:2px,color:#fff
classDef db fill:#003B57,stroke:#fff,stroke-width:2px,color:#fff
classDef cloud fill:#3448C5,stroke:#fff,stroke-width:2px,color:#fff
class APP mobile
class EDGE cf
class D1 db
class CLOUDINARY cloud
TechFix is a collaborative masterpiece built around four distinct domains, each meticulously crafted to handle a specific facet of the repair business lifecycle.
Domain: Cloudflare Workers API, D1 Database, JWT Authentication, and Global Business Logic.
- Orchestrates the serverless REST API using Node.js on Cloudflare Workers.
- Designs and maintains the Cloudflare D1 SQLite relational database schema ensuring ACID compliance.
- Implements the PBKDF2 SHA-256 password hashing and stateless JWT validation.
- Enforces strict Role-Based Authorization, API validation, and error handling.
- Powers the complex business rules for appointment lifecycles and technician assignment tracking.
Domain: Customer UI, Appointments, and Repair Tracking.
- Provides the frontend experience for end-users to register, login, and manage their devices.
- Drives the Book a Repair flow allowing customers to select services, dates, times, and map coordinates.
- Builds the live Repair Tracking timeline (
REQUESTEDβASSIGNEDβDIAGNOSINGβREPAIRINGβTESTINGβCOMPLETED). - Manages the complete Repair History viewing functionality for transparency.
Domain: Control Center, Admin Dashboard, Staff Allocation.
- Creates the Management Dashboard to view overall business health and system metrics.
- Manages Branch Operations, including geospatial coordinates and branch status.
- Administers the Technician Roster, assigning skills, specialization, and managing availability states (
AVAILABLE,BUSY,OFF_DUTY,ON_LEAVE). - Handles the manual override Technician Assignment UI, pairing pending repairs with the correct staff.
Domain: Spare Parts management, Payments processing, Analytics.
- Constructs the Spare Parts Ledger, tracking stock quantity, prices, and low-stock alerts.
- Integrates Payment Processing screens, tracking payment intents (
PAID,FAILED,REFUNDED), capturing receipts, and total costs based on parts consumed. - Builds dynamic Management Reports visualizing Revenue, Active Repairs, Parts utilization, and Branch performance metrics.
The D1 database is highly normalized to ensure data integrity during parallel API transactions and automated routing algorithms.
erDiagram
USERS ||--o| CUSTOMERS : "has profile"
USERS ||--o| TECHNICIANS : "has profile"
CUSTOMERS ||--o{ APPOINTMENTS : "books"
CUSTOMERS ||--o{ DEVICES : "owns"
BRANCHES ||--o{ INVENTORY : "stocks parts"
BRANCHES ||--o{ TECHNICIANS : "employs"
APPOINTMENTS ||--o{ REPAIR_HISTORY : "tracks status"
APPOINTMENTS ||--o{ REPAIR_PARTS : "consumes"
APPOINTMENTS ||--o| PAYMENTS : "generates invoice"
USERS {
string id PK
string role "Admin, Manager, Tech, Customer"
string email
string password_hash
}
APPOINTMENTS {
string id PK
string status "Requested, Diagnosing, Completed"
float customer_lat
float customer_lng
}
INVENTORY {
string id PK
string part_name
int stock_level
float price
}
- PBKDF2 Edge Hashing: Passwords are never stored in plaintext. They are salted and hashed natively inside the V8 engine on the Cloudflare Edge using high-iteration PBKDF2 (SHA-256).
- Stateless JWT Authorization: API tokens are generated and signed with Web Crypto API HMAC. The Worker middleware validates claims natively without requiring a database lookup for every request.
- Strict Role Boundaries: All endpoints utilize granular interceptors to match the exact role claim
(Admin, Manager, Technician, Customer)required before routing transactions. - SQL Injection Prevention: 100% parameterized queries via D1 SQLite Bindings natively prevent payload injection. Case-insensitive routing enforces email collision checks via
LOWER()SQL.
Follow these steps to deploy both the highly-available backend and the native Android frontend.
Prerequisites:
- Install Node.js and NPM.
- Install Wrangler CLI globally:
npm install -g wrangler
Click to expand backend deployment steps
- Login to Cloudflare
npx wrangler login
- Navigate to the Backend Directory
cd cloudflare-backend - Initialize the Database
Create a new D1 database via your Cloudflare Dashboard, or using the CLI:
Copy the generated
npx wrangler d1 create techfix-db
database_idand paste it intocloudflare-backend/wrangler.toml. - Set Environment Variables
Ensure
JWT_SECRETis populated in yourwrangler.tomlfile under the[vars]block for token generation to work successfully. - Run the Schema Migrations
Push the table structures to your remote D1 instance:
npx wrangler d1 execute techfix-db --remote --file=./schema.sql
- Deploy the Worker globally
This will output a live CDN URL (e.g.,
npx wrangler deploy
https://techfix-backend.<your-subdomain>.workers.dev).
Prerequisites:
- Install Android Studio (Giraffe or later).
- Java Development Kit (JDK 17).
Click to expand Android setup steps
-
Open the Project Open the root
TECHFIXfolder inside Android Studio. -
Connect the Edge Backend Open the following file:
app/src/main/java/com/mad/techfix/network/RetrofitClient.javaReplace the
BASE_URLwith your fully unified Cloudflare Worker deployment URL:private static final String BASE_URL = "https://techfix-backend.<your-subdomain>.workers.dev/";
-
Sync and Build
- Wait for Gradle to sync dependencies.
- Click Run (Shift + F10) to launch the app on an emulator or physical device.
(Add your application screenshots here in an organized grid)
| Customer Dashboard | Repair Tracking | Admin Analytics | Parts Ledger |
|---|---|---|---|
Developed dynamically for the Mobile Application Development Module.
Licensed under the MIT Licenseβββ If you find this project useful, don't forget to star the repository! βββ