A lean, embeddable AI legal research chat built on Next.js 15, TypeScript, and Tailwind CSS. It proxies questions to the Vaquill API, streams the answer word-by-word, and renders structured sources with case names, citations, court details, excerpts, and PDF links. Every request is pinned toDocumentation Index
Fetch the complete documentation index at: https://vaquill.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
countryCode: "US" server-side so it is the right pick for US-only deployments.
Source: github.com/Vaquill-AI/integrations/widget-next.
What you get
- Next.js 15 App Router with standalone build output
- Word-by-word streaming animation over SSE
- Inline
[N]citation links that anchor to the matching source card - Structured legal source cards: case name, citation, court, year, disposition, docket, excerpt, relevance score
- Per-source link priority: Vaquill-hosted statute URLs, then govinfo.gov, then external court PDFs
- Standard vs Deep RAG mode toggle
- Light and dark themes via CSS custom properties
- CORS headers pre-configured for iframe embedding
- Single env var to deploy
Prerequisites
- Node.js 18+ (download)
- A Vaquill API key (
vq_key_...) from app.vaquill.ai/settings/api. See Authentication.
Quickstart
Run the dev server
Configuration
The API key is the only secret. Everything else is hardcoded insrc/config/constants.ts so embedders edit one file and redeploy.
Environment variables
| Variable | Required | Description |
|---|---|---|
VAQUILL_API_KEY | Yes | Your Vaquill API key (vq_key_...) |
NEXT_PUBLIC_DEFAULT_MODE | No | standard or deep (defaults to standard) |
NEXT_PUBLIC_THEME | No | light or dark |
In-code configuration
Opensrc/config/constants.ts:
countryCode: "US" is enforced server-side in the API route, so even a forked client cannot accidentally widen the jurisdiction.API routes
The Next.js app exposes two serverless routes that proxy the Vaquill API:| Route | Method | Description |
|---|---|---|
/api/chat | POST | Proxy to Vaquill /ask (non-streaming, US-pinned) |
/api/chat/stream | POST | Proxy to Vaquill /ask/stream (SSE, US-pinned) |
Embedding
The widget can be embedded on any page via an<iframe>:
Deployment
Vercel (recommended)
You can also use the GitHub integration: push to a repo, import in the Vercel dashboard, set env vars, and every push redeploys.
Railway
Self-hosted
The build produces a standalone Next.js bundle (output: "standalone" in next.config.js). Any Node 18+ host works:
Troubleshooting
No response from chat- Verify
VAQUILL_API_KEYis set in.env.local(or in your deployment platform). - Test the key directly:
curl -H "Authorization: Bearer vq_key_..." https://api.vaquill.ai/api/v1/health. - Check that you have credits at app.vaquill.ai/billing.
frame-src directive.
Streaming stops mid-response
Some reverse proxies buffer SSE. If you deploy behind Nginx, disable buffering for the /api/chat/stream location:
Related
Docker Widget
Self-host with Docker Compose and embed via script tag.
Widget Pro
Adds multi-thread sidebar, voice mode, and gamification.
Ask API
The endpoint this widget proxies.
GitHub
Source code and issue tracker.

