> ## Documentation Index
> Fetch the complete documentation index at: https://docs.okrapdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Edge ChatPDF

> Ship PDF chat on edge runtimes without Node-only parsing dependencies

## 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

1. Upload PDF by URL and store `doc_id` in your own app database.
2. Send user questions + `doc_id` to Okra's OpenAI-compatible endpoint.
3. Stream responses back in real-time from an edge function.

No local PDF parsing, no vector schema migration, no runtime-specific workarounds.

## 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`

## Build path

<Steps>
  <Step title="Deploy upload endpoint">
    Accept a PDF URL, call OkraPDF once, save returned `doc_id`.
  </Step>

  <Step title="Deploy chat endpoint">
    Forward chat turns plus `doc_id` to Okra's model endpoint and stream result.
  </Step>

  <Step title="Ship UI">
    Keep frontend simple: URL input, document list, and chat panel.
  </Step>
</Steps>

## Related Docs

<CardGroup cols={2}>
  <Card title="SDK Quickstart" icon="rocket" href="/developers/sdk">
    Session-first runtime usage for upload, wait, and prompt flows.
  </Card>

  <Card title="Document Chat API" icon="message" href="/api-reference/chat/chat-with-document">
    API contract for chat requests against document context.
  </Card>
</CardGroup>
