## Building a Self-Hosted PDF-to-AI Pipeline with FastAPI and Next.js

Every time I started building an AI application that needed to work with PDFs, I ran into the same problem.
The document parser wasn't the difficult part.
Everything around it was.
I needed to build:
Upload handling
Background processing
Export pipelines
Packaging
Progress tracking
Download workflows
A frontend
By the time I finished all of that, I'd spent more time building infrastructure than building the AI application I actually cared about.
Why local processing mattered
Another requirement I had was keeping document processing under my own control.
Many document workflows involve:
Internal documentation
Research
Contracts
Proprietary manuals
Company knowledge bases
For those kinds of documents, I preferred running the processing locally or on infrastructure I control rather than sending files to a third-party service.
What I built
To solve that problem, I built RelayWorks.
RelayWorks is a self-hosted FastAPI and Next.js application that prepares documents for downstream AI workflows.
It generates:
Markdown
HTML
JSON
Plain text
Extracted images
Processing reports
Downloadable output packages
Instead of spending days assembling a complete document-processing workflow, I wanted a toolkit that was already organized and ready to customize.

Who it's for
RelayWorks is designed for developers building:
Retrieval-Augmented Generation (RAG) systems
Internal AI tools
Knowledge bases
Document automation workflows
Lessons learned
A few things surprised me while building the project.
The parser isn't the hard part.
The surrounding infrastructure usually takes significantly longer than extracting text.
Clean outputs matter.
Generating structured Markdown and JSON saves a lot of downstream cleanup when preparing data for AI systems.
User experience matters.
Progress indicators, downloadable packages, and clear outputs dramatically improve usability compared to command-line-only workflows.
Closing thoughts
Building RelayWorks taught me that the biggest challenge wasn't extracting text from documents—it was turning that extraction into a workflow developers could actually use.
I'd be interested to hear how others are approaching document ingestion today.
If you've built RAG systems or AI document pipelines, what's been the biggest challenge in your workflow?
Website:
https://getrelayworks.com
GitHub Showcase:
https://github.com/DevCalebR/relayworks-document-processing-showcase
Top comments (0)