Skip to content
← Engineering
AFM · Historical document preservation

Give historical documents a searchable future.

A digitisation workspace for the Apostolic Faith Church Legacy Department, connecting mobile document capture, OCR-assisted transcription, editorial review and archive search. I worked across the FastAPI backend and Next.js frontend to carry a scan through to a reviewed record.

Role
Full-stack engineer
Context
Legacy Department · Document digitisation
Year
2026
Stack
Next.js · FastAPI · PostgreSQL · SQLAlchemy
Archive workflow: capture and order document pages, extract a draft transcription and metadata, review against the scan, then approve for archive search and export. Processing failures can be retried or re-uploaded.
Workflow illustration based on the archive. Document shapes are illustrative; no archival material is reproduced.

Capture

Mobile

scan pages and continue a grouped document

Review

Human

check the transcription and metadata

Search

Approved

review status controls archive discovery

Export formats

3

TXT, DOCX and PDF transcripts

The problem

A collection of photographed pages is difficult to search, organise and reuse. Historical letters, periodicals and manuscripts also have structure: page order, columns, headings and handwritten or uncertain details. Losing that structure during transcription makes the resulting text less useful.

The archive connects the physical document to a digital record. Capture needs to work from a phone; reviewers need to compare the extracted text with the source; and approved material needs to be discoverable and exportable. Each step carries information that the next step depends on.

My contribution

I worked across the FastAPI backend and Next.js frontend on document capture, processing, review and archive access. The implementation connects grouped page records, transcription and metadata extraction, review decisions, search and transcript exports.

Much of the practical work was in the transitions: resuming a partially scanned document at the right page, preserving reading order in a two-page spread, keeping long transcriptions usable on a phone, and making authenticated downloads work across the interface and API.

The archive workflow

  • Capture and organisePhotograph a document from a phone or upload a scan. Group related pages into a work, retain their order, and resume capture with the next page number.
  • Extract a draftProcess the image into a transcription and suggested metadata such as document type, author, date and summary. Processing state remains visible while the job runs.
  • Review the sourceInspect the scan alongside its transcription, correct the record and approve or reject it. Suggested metadata remains something an archivist can check.
  • Find approved materialSearch approved records using PostgreSQL full-text search, relevance ranking and archive filters. Search access is restricted to authorised archive users.
  • Export the transcriptDownload reviewed text as TXT, DOCX or PDF. The transcript export keeps the text separate from the source images.

Engineering decisions

  • Keep page structureA grouped work retains page sequence and document-level context. Normalised page labels and the next-page position make interrupted capture sessions easier to continue.
  • Respect reading orderImage-processing heuristics identify likely two-page spreads using shape and the centre gutter. Transcription instructions preserve column order, headings and paragraph breaks.
  • Separate text and interpretationVerbatim transcription and metadata extraction use separate prompts. A suggested date or summary is kept distinct from the document's own words, and review precedes approval.
  • Make failures recoverableProcessing jobs expose status and recovery guidance. Transient connection failures are retried; missing images can require a new upload. The interface can distinguish those recovery paths.

Connecting the system

The Next.js application provides mobile capture and review screens alongside desktop document workspaces. FastAPI coordinates document records, image processing, model calls and exports, with SQLAlchemy and PostgreSQL storing the archive's relationships and review state.

A document can retain references to its original and processed images, its extracted text, metadata and approval history. Approval decisions create audit records, while the search endpoint selects approved documents. This makes the editorial decision part of the data model and the discovery workflow.

Delivery and limits

The June 2026 baseline records grouped mobile capture, review workspaces, page ordering and TXT, DOCX and PDF exports. Its fixes include long-transcription scrolling, resuming at the next page number, authenticated downloads and preserving layout cues during transcription. Later maintenance addressed packaging, deployment and account access.

The implementation demonstrates a connected digitisation workflow. OCR quality still depends on the scan and the material, and inferred metadata needs checking. No measured transcription-accuracy score, collection-wide usage total or processing-time improvement is claimed here.

What the work demonstrates

An archivist can move from a captured page to a reviewed, searchable record while keeping the source available for comparison. Multi-page material stays organised as a work, and its transcript can be taken into other tools for reading or further editing.

The engineering lesson was to carry context through the whole pipeline. Page order, reading structure, review status and the original scan all matter to whether extracted text becomes a useful archive record.