Case studies
Custom

Docember AI

A Bubble AI workflow migration with recoverable jobs and visible unit cost

  • Custom
  • AI document processing
  • Bubble

30days

Delivery

100/100

Interrupted-job recovery

993/1,000

99.3%

Valid outcome within 10 minutes

94.0%

unchanged

Extraction exact-match accuracy

Illustrative before/after figures.

The product

Users uploaded documents, reviewers checked uncertain fields and administrators investigated failures. The workload covered five known layouts, one to 20 pages each, with 20 concurrent jobs. An external AI provider supplied extraction. The product already had upload, review and export flows; it did not need new training or additional document categories. The important business boundary was the difference between generated output and an approved result.

The challenge

The story began with jobs that looked stuck after browser disconnects or provider timeouts. Resubmitting could repeat paid processing, while a partial response could appear complete. Discovery traced the lifecycle and considered moving only the worker out of Bubble. The selected Custom rebuild also addressed ownership of review state and cost records. A new application stack was not treated as evidence of better model accuracy.

The operations lead wanted an uploaded document to reach a clear outcome even when a provider call timed out or a worker restarted. Re-running the whole process could bill the same work twice and overwrite reviewer decisions. We fixed the model, five document layouts and acceptance labels, then compared job orchestration under the same quality requirements. The purchase was dependable processing and inspectable cost per accepted document, not a claim that migration made the model smarter.

How we tackled it

  1. 01

    Persist the job. Upload created a durable record with queued, running, review-required, completed and failed states.

  2. 02

    Checkpoint processing. Each stage retained enough information to resume after interruption without losing reviewer changes.

  3. 03

    Classify retries. Known failures and unknown provider outcomes followed different handling, limiting duplicate paid work where the provider contract allowed.

  4. 04

    Protect approval. Schema and business checks routed incomplete output to review. Export required the approved document version.

What we built

Next.js and TypeScript served upload and review screens. Postgres with Drizzle held job state, decisions and cost entries. Private storage retained source documents, and a durable worker processed a bounded queue. Correlation identifiers connected application steps and provider operations. Managed authentication protected submitter and reviewer roles. Routine diagnostics omitted document content. The existing model remained an external dependency with recorded configuration.

The rehearsal disconnected clients, interrupted workers, injected invalid responses and simulated rate limits. A labelled 200-document subset supported paired quality evaluation. During cutover, in-flight jobs were drained or transferred under one recorded owner; they were not all blindly resubmitted. Recovery preserved completed output and review decisions. The receiving engineer demonstrated an interrupted-job recovery and traced its processing cost in the ledger.

Before & after — illustrative results

The example compares 1,000 jobs under the same model settings and workload. Failed jobs remain failures in the completion measure. Accuracy stays at 94.0% field-level exact match in the invented paired evaluation, illustrating a neutral quality outcome rather than claiming an improvement. Unit cost falls from $0.28 to $0.17, a 39.3% reduction, with reviewer labour excluded and disclosed. No provider invoice or actual benchmark supports these values.

Illustrative before/after values. No tests or client measurements were performed for this story. The comparison conditions describe how an equivalent real migration would be evaluated; they are not a test report.

MetricBeforeAfterComparison conditions
Interrupted-job recovery71/100 defined interruptions recover correctly100/100 recover correctlyOne valid terminal state; preserve review decisions; explicit failures remain visible.
Valid outcome within 10 minutes910/1,000 jobs — 91.0%993/1,000 — 99.3%Healthy provider, 20 concurrent jobs; completed or valid review-required; failures excluded.
Extraction exact-match accuracy94.0%94.0% — unchangedSame labelled 200-document set, scoring rule, model and settings; values.
Processing cost per accepted document$0.28$0.17 — 39.3% lowerProvider usage plus stated infrastructure allocation; reviewer labour excluded; not a quote.
Operator recovery effort per interrupted batch, median25 min7 minTen fixed 100-document batches with injected interruptions; same operator; preserve accepted outputs and review decisions.
Illustrative monthly processing TCO$3,200 at 10,000 accepted documents$2,300 at the same volume — 28.1% lowerBefore: $2,800 processing + $400 maintenance; after: $1,700 + $600. Reviewer labour and one-time migration excluded and shown separately in an actual business case.

The outcome

Docember ended the demonstration with observable queues, resumable work and an approval boundary the reviewer could explain. The founder could examine cost per accepted document alongside failure and review rates instead of relying on token totals alone. Handover included retry policy, model versions and the evaluation harness. The commercial lesson is to make AI operations accountable without confusing infrastructure reliability with intelligence.

Why these improvements mattered

Bounded retries reduced duplicate provider work, while the ledger made exceptions visible. The illustrative TCO includes a higher maintenance allowance after migration, so it does not confuse a lower API bill with the whole operating cost. Extraction quality remains unchanged in this story; any future model upgrade needs a new evaluation.

Scope & timeline

Scope

Custom included the job-state model, durable worker, provider integration, evaluation harness and cost ledger. Model settings and the five layouts remained fixed for the comparison. The trade-off was explicit queueing under bounded concurrency, rather than promising immediate processing for every upload. Reviewer labour was tracked separately from provider and allocated infrastructure cost. Those boundaries made both the architecture and the unit economics discussable.

Delivery timeline

Delivery schedule: 30 working days. Team: Two senior engineers, shared QA and an available document-domain reviewer. The clock starts after scope approval, usable source data, test access and agreed UI are available. Waiting for external approvals is excluded. This is a bounded example, not a turnaround guarantee.

Days 1–5: define job states, quality fixtures and the cost allocation.

Days 6–18: build durable workers, retry boundaries and the review ledger.

Days 19–27: run interruption, quality and cost comparisons.

Days 28–30: pilot the fixed document set and transfer operations.

FAQ

Does migrating an AI app improve model accuracy?
Not automatically. Reliability, quality and cost need separate evaluation, with the same documents and model settings for a fair comparison.
Can long AI processing run outside the browser request?
Yes. Durable jobs and persisted state can separate processing from the interactive request, with explicit recovery and provider retry rules.

Discuss a similar migration

Bring an interrupted job, its usage record and examples your reviewer accepts or rejects. Bubble to Code can define the recovery boundary, evaluation method and cost assumptions for a Custom migration. Compare a focused worker extraction with a full rebuild before committing to either.