Delivered remotely for a business based in Edinburgh, United Kingdom. Names withheld by agreement.
Project Overview
Across the United Kingdom, independent contractors, agency consultants, and distributed SMEs spend unnecessary hours every month reconstructing travel spend from crumpled thermal paper and bank statements. Existing desktop-centric expense portals assume reliable broadband and force workers to batch-upload receipts weeks after a trip—by which time VAT breakdowns are illegible and project codes are forgotten.
Designed around mobile reality in Edinburgh and across UK rail corridors, this React Native and Firebase application turns expense capture into a three-second habit. Claimants snap receipts, record HMRC-compliant mileage legs, and assign client cost centres directly from iOS or Android devices, even without signal. Once online, Firebase Cloud Functions extract structured tax fields, check company policy thresholds, route claims to managers, and compile bookkeeping-ready export bundles.
Field Capture & Reconciliation Friction
Building for mobile spend management exposed operational pitfalls that frequently break simpler receipt apps:
- Signal blackouts during travel: Train journeys, basement conference rooms, and remote client sites cause naive multipart uploads to time out mid-flight, leaving claimants unsure whether a receipt was saved.
- Inconsistent VAT visibility: UK receipts vary wildly in how they print standard-rate, reduced-rate, and zero-rated VAT lines; blindly treating a fixed fraction of the gross total as reclaimable tax creates audit exposure.
- Stalled approval loops: Without instant mobile push notifications and clear line-by-line rejection notes, finance teams chase employees over email just before month-end close.
- Unbounded image bloat: Modern phone cameras produce multi-megabyte photos that burn mobile data plans and slow down reviewer queues if left uncompressed.
Architectural Strategy
We treated the mobile device as an autonomous capture station backed by a cloud verification pipeline. In React Native, camera capture, edge cropping, and JPEG normalization happen strictly locally, writing deterministic metadata rows into SQLite immediately. That design decouples the user's capture speed from network latency.
In the cloud, Firebase orchestrates identity, stateful approval workflows, and event-driven OCR extraction. Rather than trusting mobile clients to enforce spend limits or mark claims reimbursed, Cloud Functions own every state transition (Draft → Submitted → Approved / Returned → Exported), writing immutable audit trails alongside each receipt.
Core Capabilities
- Instant Camera Capture & Edge Normalization: Auto-crops thermal slips, boosts contrast for faded ink, and shrinks payloads locally before queuing uploads.
- Automated OCR & VAT Field Parsing: Extracts merchant name, transaction date, currency, gross total, and explicit VAT amounts, highlighting low-confidence fields for rapid review.
- Mileage & Multi-Currency Expense Entry: Calculates distance claims using configurable tiered rates alongside automatic GBP conversion notes for overseas travel.
- Policy Guardrails & Duplicate Detection: Flags missing tax receipts, weekend spend exceptions, category caps, and matching receipt fingerprints before submission.
- Manager Review & Accounting Exports: Streams approval requests via Firebase Cloud Messaging and generates clean, reconciled CSV and JSON ledgers tailored for UK bookkeeping software.
Technical Architecture
When a user photographs a receipt, React Native saves a compressed binary locally and inserts an unuploaded task into SQLite. Once network reachability is verified, the upload worker streams the file to a user-scoped path in Firebase Cloud Storage and creates a pending Firestore expense record.
Flow: React Native Camera & SQLite Outbox → Firebase Cloud Storage → Cloud Function Trigger → Cloud Vision OCR & VAT Parser → Firestore Claim Document → FCM Reviewer Notification & Accounting Export
Cloud Storage finalization triggers a serverless Cloud Function that invokes Cloud Vision OCR, runs regular-expression and arithmetic cross-checks on subtotal plus VAT, checks perceptual/amount hashes for duplicates, and patches the Firestore expense document. Real-time Firestore listeners update the claimant's mobile screen seamlessly while notifying assigned managers when a batch is submitted.
Technology Stack
| Category | Technology detail |
|---|---|
| Mobile Client | React Native (iOS and Android) with native camera and document-crop modules |
| Shared Type Safety | TypeScript across mobile app state, policy rules, and serverless functions |
| Offline Device Store | SQLite draft ledger and binary upload queue for disconnected receipt capture |
| Cloud Data & Sync | Firebase Cloud Firestore with composite indexes and real-time approval listeners |
| Receipt Binary Storage | Firebase Cloud Storage with scoped security rules and lifecycle compression |
| Serverless Workflows | Firebase Cloud Functions for OCR parsing, policy validation, and CSV/JSON exports |
| Receipt Extraction | Cloud Vision OCR paired with heuristic UK/EU VAT and date parsers |
| Authentication & Alerts | Firebase Authentication with custom role claims and FCM approval push alerts |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Multi-megabyte camera images exhausting cellular data and OCR quotas | Added on-device resizing, grayscale contrast enhancement, and target quality compression before queuing; required a lightweight native image-processing bridge in React Native, cutting transfer sizes dramatically. |
| Cloud Vision OCR misreading faded thermal digits or multi-rate VAT receipts | Built a deterministic arithmetic validator comparing extracted subtotal + tax against gross total and flagging discrepancies for manual confirmation rather than silently saving bad tax figures. |
| Concurrent edits between an employee revising a draft and a manager reviewing a claim | Enforced strict status locks in Firestore Security Rules so submitted claims become read-only for claimants unless explicitly returned by an approver. |
| Firestore lacks native complex multi-column aggregation for tax-year exports | Maintained incremental per-period summary counters via Cloud Functions and generated export files asynchronously in Cloud Storage rather than running heavy client-side scans. |
Security & Reliability
Receipt images frequently contain partial card numbers, home addresses, or confidential client dinner details. Every binary object in Firebase Cloud Storage sits behind strict path-based rules validating both request.auth.uid and organization membership claims, accessed exclusively via short-lived signed URLs during review.
All state-mutating operations run through TypeScript-validated Cloud Functions that enforce idempotency keys on claim submissions and export generation. Should an OCR call fail transiently due to upstream throttling, dead-letter retry metadata lets the background worker re-run extraction without asking the employee to re-photograph the receipt.
Performance & Scale
Mobile responsiveness hinges on keeping the JavaScript bridge clear during image manipulation and list scrolling. Heavy image resizing executes off the UI thread via native modules, while expense history lists render through virtualized FlatList components backed by indexed SQLite queries for instant cold-start rendering.
On the Firebase side, composite Firestore indexes power filtered manager queues (organizationId + status + submittedAt) in single-digit milliseconds regardless of historical archive size. Monthly bookkeeping exports stream batches incrementally inside Cloud Functions to stay comfortably within serverless memory ceilings during end-of-month submission rushes.
Operational Outcomes
Moving expense tracking from shoeboxes and ad-hoc spreadsheets into an offline-capable mobile workflow improved visibility for both individuals and finance leads:
- Zero lost receipts in transit: Claimants capture and queue expenses immediately at the point of purchase regardless of underground or rural connectivity.
- Cleaner VAT reclaim records: Structured tax-line extraction and arithmetic checks reduce manual bookkeeper corrections during quarterly VAT returns.
- Shortened reimbursement turnaround: Instant push alerts and pre-flagged policy exceptions let managers approve clean reports in minutes instead of chasing email threads.
- Consistent audit trail: Immutable approval timestamps paired with original receipt imagery simplify external accountant reviews and expense audits.