Browse docs

Framework Integration Map

Choose the right Mighty pattern for chat, uploads, backend APIs, serverless routes, and agent frameworks.

Every framework integration is the same idea: scan on the server before trust.

The framework only changes where you put the helper.

Core concept

Put Mighty before trust.

Untrusted materialPrompt, file, image, OCR text, model output
Mighty scanPOST /v1/scan returns action, risk, IDs, and signals
Your routingContinue, review, redact, or block before automation acts
Mighty does not prove fraud. It gives your product a consistent trust checkpoint before AI, OCR, storage, agents, or human review depend on the material.

Choose Your Pattern

StackPut Mighty hereUse this guide
Vercel AI SDK chatInside app/api/chat/route.ts, before streamText, and before strict output returns.Vercel AI SDK
Next.js uploadsInside the upload Route Handler before storage, OCR, or extraction.Next.js file upload
Backend APIIn a server helper or middleware before the handler calls AI, OCR, storage, or tools.Backend API helpers
OpenAI SDKScan prompt before model call. Scan output before public display or automation.Backend API helpers
LangChainScan user input before chain invocation. Scan retrieved docs and tool output before adding them to context.Backend API helpers
LlamaIndexScan query input, retrieved nodes, extracted text, and final response before trust.Backend API helpers
Async reviewSubmit mode=comprehensive, async=true, then poll or handle webhooks.Async scans

Integration Rules

  • Keep MIGHTY_API_KEY on the server.
  • Scan before the model, OCR, storage, workflow automation, payment, or agent action.
  • Use scan_phase=input for submitted material.
  • Use scan_phase=output for generated, extracted, summarized, or agent-created material.
  • Reuse scan_group_id for related input, file, OCR, output, and review scans.
  • Use session_id for the wider chat, claim, case, batch, or agent run.
  • Route ALLOW, WARN, BLOCK, indeterminate, and async pending.
  • Use safe fallback behavior when Mighty cannot be reached.

Framework Traps

TrapFix
Calling Mighty from browser codeMove scan calls to a server route.
Scanning only the initial promptScan model output, tool output, OCR output, and extracted fields too.
Returning JSON from a useChat route that expects a UI message streamFor Vercel AI SDK streaming routes, return toUIMessageStreamResponse or createUIMessageStreamResponse.
Losing scan_group_id between upload and OCRPersist it on the item, not only in logs.
Treating framework errors as safeFail closed or use review fallback for high-risk workflows.
Next step

Ready to scan real traffic?

Create an API key, keep it on your server, then wire Mighty into the workflow that handles untrusted material.

AI-Agent Prompt

AI-ready prompt
Choose the Mighty framework pattern

Paste this into Cursor, Codex, Claude Code, or Windsurf.

Choose the correct Mighty framework integration pattern.

Rules:
- Use server-side scan calls only.
- Put POST /v1/scan before AI, OCR, storage, workflow automation, payment, and agent action.
- Use the Vercel AI SDK route pattern for app/api/chat/route.ts.
- Use the Next.js upload route pattern for browser file uploads.
- Use the backend API helper for Node, Python, Express, FastAPI, Flask, Django, workers, queues, and custom APIs.
- For LangChain and LlamaIndex, scan before chain invocation, before retrieved content enters context, before tool output is reused, and before final output is shown.
- Preserve scan_id, request_id, scan_group_id, session_id, action, and risk_score.

Acceptance criteria:
- API key never reaches client code.
- Existing framework response shape is preserved.
- Tests cover ALLOW, WARN, BLOCK, and scan failure.