Why this demo exists
Most edge-runtime PDF attempts fail on Node-specific dependencies (fs, pdf-parse, pdfjs-dist assumptions).This demo uses OkraPDF as a network-native PDF layer so your edge function only does
fetch().
What it proves
- Upload PDF by URL and store
doc_idin your own app database. - Send user questions +
doc_idto Okra’s OpenAI-compatible endpoint. - Stream responses back in real-time from an edge function.
Security and performance angle
- Your edge code never handles raw PDF parsing internals.
- The app stores stable document references (
doc_id) instead of large blobs. - Streaming chat stays fast because retrieval happens close to the document system.
Demo Source
runtime-demo/demos/supabase-chatpdf