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.