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 statute source cards: section title, citation, code, title, jurisdiction, excerpt, relevance score
- Per-source link priority: Vaquill-hosted statute URLs, then govinfo.gov
- Standard vs Deep search 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
1
Clone and install
2
Add your API key
.env.local and set:3
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
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:
Example request body:
Embedding
The widget can be embedded on any page via an<iframe>:
Deployment
Vercel (recommended)
1
Install the CLI
2
Deploy
3
Set the API key
In the Vercel dashboard, open Project Settings > Environment Variables and add:
VAQUILL_API_KEY=vq_key_your_key_here
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.
Statutes Search API
The endpoint this widget proxies.
GitHub
Source code and issue tracker.

