# Framework Integration

Drop chunk-engine into any web handler — the same three-step recipe across Python, JavaScript, and Rust frameworks.

chunk-engine is a plain library call with no services, no global state, and no
warm-up. That makes web integration the same everywhere, in every language:

1. **Read the uploaded bytes** from the request.
2. **Pass them with a `filename`** so the engine can route by extension (a named
   `Blob`/`File` supplies its own name).
3. **Return the chunks** — or stream them as they're produced.

  Handlers below use the default mode for brevity. In practice pass
  `mode="semantic"` for LLM/RAG ingestion or `mode="section"` for search
  indexing — see [Chunking Modes](/docs/chunking-modes).

## By language

  - [Python](/docs/framework-integration/python) — FastAPI, Flask, Django, Litestar, aiohttp, Celery.
  - [JavaScript](/docs/framework-integration/javascript) — Express, Fastify, Hono, Next.js, NestJS, SvelteKit — Node, Bun, Deno.
  - [Rust](/docs/framework-integration/rust) — Axum, Actix Web, Rocket, Warp.

## Streaming responses

All three language pages now carry an NDJSON streaming handler:

| Language | Handler |
| --- | --- |
| Python | [FastAPI `StreamingResponse`](/docs/framework-integration/python#fastapi--streaming-response) |
| JavaScript | [Next.js `ReadableStream` and Express](/docs/framework-integration/javascript#streaming-an-ndjson-response) |
| Rust | [Axum NDJSON body](/docs/framework-integration/rust#axum--streaming-ndjson) |

  Forwarding chunks as NDJSON always makes the response incrementally
  consumable, but only three formats (PDF, spreadsheets, CSV) parse
  incrementally, and only in native Rust and Python. JavaScript's `streamChunks`
  computes the whole array before it yields the first item. Read
  [Streaming](/docs/streaming) before you rely on a handler to survive a file
  that `getChunks` could not.

## Errors

Each page's handlers assume the happy path; map failures onto status codes
explicitly. The [Rust page](/docs/framework-integration/rust#axum--with-real-error-mapping)
has a complete `ChunkError → IntoResponse` mapping (415 / 400 / 422 / 500) and
the [JavaScript page](/docs/framework-integration/javascript#errors) has the
same table for `ChunkError.kind`. The full contract is in
[Error Handling](/docs/error-handling).
