HomeCase studiesPrepaid-Hours Workforce Operations and Automated Billing Platform

Case study · Lyon, France

Prepaid-Hours Workforce Operations and Automated Billing Platform

Remote staffing and outsourced professional services

This platform centralizes client onboarding, remote talent assignment, daily time logging, and prepaid-hour block billing for an international remote staffing provider. Built with React and TypeScript on the frontend and backed by Firebase and Google Cloud serverless infrastructure, the system treats purchased staffing hours as a real-time ledger rather than end-of-month guesswork. Stripe powers automated package purchases and low-balance top-ups, while SendGrid delivers transactional digests, threshold warnings, and settlement receipts.

Industry
Remote staffing and outsourced professional services
Solution
A serverless web operations and billing platform managing remote talent allocations, verified time tracking, prepaid-hour ledgers, and automated Stripe renewals.
Platforms
Web & API
Stack
React · TypeScript · Firebase · Google Cloud · Stripe · SendGrid
Location
Lyon, France · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Lyon, France. Names withheld by agreement.

Project Overview

Remote staffing businesses that sell blocks of prepaid specialist hours face an operational gap when they rely on generic timesheet tools paired with manual invoicing spreadsheets. Clients lose track of how fast their purchased hours are burning across multiple remote assistants or engineers, coordinators spend hours reconciling time logs every Friday, and overdue renewals force awkward pauses in active engagements.

This system replaces fragmented spreadsheets and manual billing reminders with a dedicated workforce operations and prepaid-hours platform. Clients purchase hour packages, monitor real-time utilization across assigned remote team members, and configure automated renewals via Stripe, while remote specialists log verified shifts and operations managers oversee capacity—all inside a single React, TypeScript, Firebase, and Google Cloud application.

Business Bottleneck

Before introducing an integrated prepaid-ledger architecture, staffing operations encountered recurring friction across finance and client success:

  • Delayed burn-rate visibility: Clients discovered depleted hour packs only after month-end spreadsheet reconciliations, creating surprise overage invoices and billing disputes.
  • Manual reconciliation overhead: Operations staff cross-checked contractor logs against payment receipts manually before authorizing additional shifts.
  • Disconnected communication loops: Low-balance warnings, shift approvals, and payment confirmations went out ad hoc, causing avoidable delays in staffing continuity.

Architectural Strategy

The platform adopts a reactive, event-driven serverless design built on Google Cloud and Firebase, paired with a strict TypeScript React single-page application. Rather than computing balances via nightly batch scripts, every time entry, hour-pack purchase, credit adjustment, and rollover is recorded as an append-only ledger entry in Cloud Firestore.

Google Cloud Functions act as the sole trusted writer for financial and ledger mutations. Clients and remote workers interact with the React UI using Firebase Authentication and custom role claims, while Firestore Security Rules prevent browsers from altering hour balances directly. External billing flows integrate tightly with Stripe via signed webhooks, and SendGrid delivers structured transactional notifications keyed to real-time ledger thresholds.

Core Capabilities

  • Prepaid Hour-Block Ledger: Immutable credit and debit ledger tracking active packages, expiry/rollover rules, bonus credits, and per-assignment burn rates in real time.
  • Role-Tailored React Workspaces: Dedicated views for client managers (approvals, burn charts, invoices), remote specialists (shift logging, task notes), and internal staffing coordinators (utilization, margin checks).
  • Automated Stripe Replenishment: Self-serve package checkout plus configurable low-balance auto-top-up workflows using saved Stripe payment methods and SCA-compliant receipts.
  • Threshold & Digest Notifications: Automated SendGrid templates triggered on low-hour thresholds, weekly utilization summaries, shift disputes, and payment failures.
  • Multi-Timezone Shift Normalization: UTC-normalized shift capture with localized display for distributed teams spanning Europe, the Americas, and Asia.

Technical Architecture

User interactions stream through Firebase Auth and Cloud Firestore, while privileged ledger updates and external billing webhooks execute inside stateless Google Cloud Functions.

Flow: React + TypeScript Client -> Firebase Auth & Firestore -> Google Cloud Function (Atomic Ledger Transaction) -> Stripe Billing API / Webhooks -> SendGrid Event Mailer -> Live Balance Sync.

Treating remaining hours as a derived transactional sum inside Cloud Functions guarantees that even when several remote staff log hours simultaneously for the same client account, every deduction lands cleanly in sequence and triggers threshold notifications exactly once.

Technology Stack

Category Technology Detail
Frontend Application React SPA delivering distinct client, contractor, and operations portals
Type Safety TypeScript enforcing shared ledger, time-entry, and billing DTO contracts
Auth & Realtime DB Firebase Authentication and Cloud Firestore for live hour-balance sync
Serverless Compute Google Cloud Functions executing ledger deductions and Stripe webhooks
Payment Processing Stripe Checkout, saved payment methods, and auto-replenish invoicing
Transactional Email SendGrid dispatching timesheet approvals, low-hour alerts, and receipts
Scheduled Jobs Google Cloud Scheduler triggering weekly utilization digests and rollovers
Access Control Firestore Security Rules combined with Firebase Custom Claims per tenant

Engineering Trade-offs & Solutions

Architectural Dilemma Chosen Solution & Rationale
Mutable balance counter only vs. append-only ledger + cached balance Stored every purchase and time deduction as an immutable ledger document alongside a transactionally updated summary balance, providing instant reads plus full auditability.
Dedicated Node/SQL server vs. Firebase & Google Cloud Functions Adopted serverless Cloud Functions and Firestore to gain real-time dashboard updates and automatic webhook scaling without managing persistent database infrastructure.
Client-side Stripe confirmation vs. webhook-driven crediting Credited purchased hour packs exclusively from verified Stripe webhook handlers with idempotency keys so closed browser tabs never lose paid hours.
Ad-hoc email triggers vs. event-driven SendGrid templates Decoupled email formatting into versioned SendGrid dynamic templates invoked by Firestore triggers, keeping copy updates independent from application deployments.

Security & Reliability

Multi-tenant staffing platforms segregate sensitive contractor rates, client billing credentials, and shift logs across hundreds of independent organizations. Firebase Authentication assigns tenant identifiers and role claims inside signed JWTs, enforced directly at the database layer via Firestore Security Rules so client queries can never cross organizational boundaries.

All Stripe interactions follow zero-card-storage compliance using Stripe Elements and Checkout sessions, while incoming webhooks validate cryptographic signatures and deduplicate retries using stored Stripe event IDs. Cloud Functions execute hour deductions inside Firestore ACID transactions, ensuring partial failures never credit Stripe payments without updating balances—or deduct hours twice on network retries.

Performance & Scale

Real-time Firestore listeners eliminate polling overhead on active client and coordinator dashboards; updates propagate selectively only to subscribed documents belonging to the user's organization. TypeScript code-splitting separates heavy administrative reporting modules from lightweight contractor time-logging views, keeping daily clock-in interactions fast even on modest laptops.

Scheduled Google Cloud jobs fan out weekly utilization digests and package expiration checks in bounded batches, respecting SendGrid API rate limits with dead-letter retry queues so transient email provider slowdowns never drop billing notices.

Operational Outcomes

Transitioning from manual spreadsheets to an automated prepaid-hours ledger eliminated end-of-month billing surprises for remote staffing clients and removed repetitive reconciliation work from finance staff. Account coordinators gained immediate visibility into clients approaching zero balance, while automated Stripe top-ups and SendGrid alerts kept active remote teams working without billing interruptions. Shared TypeScript contracts across React and Google Cloud reduced regression risks as new package tiers and reporting views shipped.

01 — Questions

asked about this kind of project

How does the prepaid-hours ledger prevent negative balances or double deductions?

Every approved or submitted time log triggers a Google Cloud Function wrapped in a Firestore atomic transaction. Concurrent submissions from multiple remote specialists assigned to the same client serialize cleanly against the client's active hour bucket without race conditions.

Why pair Firebase and Google Cloud Functions with Stripe instead of running a traditional relational billing server?

Remote staffing coordinators and clients expect live visibility into remaining hours as shifts conclude. Firestore pushes real-time balance updates straight to React dashboards, while Google Cloud Functions provide isolated, event-driven execution for Stripe webhooks and ledger mutations without idle server maintenance.

How are Stripe webhook retries handled safely so clients are never credited twice for one payment?

The webhook endpoint verifies Stripe cryptographic signatures first and records each processed Stripe event ID inside a Firestore idempotency document within the same transaction that credits the client's hour balance.

What happens when a client's prepaid hour balance drops below threshold mid-week?

Threshold listeners inside Google Cloud trigger SendGrid alerts to the client's billing contacts and account manager. Clients with auto-replenish enabled automatically purchase their configured hour pack via saved Stripe mandates, avoiding work stoppages.

How does TypeScript reduce defects across client, contractor, and admin interfaces?

Shared TypeScript interfaces model hour-pack states, time-entry statuses, timezone-normalized shift timestamps, and currency calculations identically across the React frontend and Cloud Functions backend, catching schema mismatches at compile time.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.