Track every API call from Server Components, API Routes, and Server Actions. Works on Vercel, self-hosted, and everywhere Next.js runs.
Get started in seconds:
npm install @outboundiq/nextjsUse Next.js instrumentation for automatic tracking in Server Components
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('@outboundiq/nextjs/register');
}
}module.exports = {
experimental: {
instrumentationHook: true,
},
};# .env
OUTBOUNDIQ_KEY=your_keyFetch calls in Server Components are automatically tracked via instrumentation.
// app/page.tsx
export default async function Page() {
// Automatically tracked!
const data = await fetch('https://api.example.com');
return <div>{JSON.stringify(await data.json())}</div>;
}Use trackFetch for explicit tracking in route handlers.
// app/api/data/route.ts
import { trackFetch } from '@outboundiq/nextjs';
export async function GET() {
const data = await trackFetch('https://api.example.com');
return Response.json(data);
}Server Actions that make API calls are automatically tracked.
// app/actions.ts
'use server'
export async function submitForm(data) {
// Automatically tracked!
await fetch('https://api.example.com/submit', {
method: 'POST',
body: JSON.stringify(data)
});
}Track which user made each API call with middleware integration.
// middleware.ts
import { withOutboundIQ } from '@outboundiq/nextjs/middleware';
export default withOutboundIQ(async (req) => {
return NextResponse.next();
}, {
getUserContext: async (req) => {
const token = await getToken({ req });
return { userId: token?.sub };
},
});Works seamlessly with Vercel's serverless and edge infrastructure
Standard API routes and Server Components run in Node.js runtime. Automatic tracking via instrumentation.ts.
Edge routes work with trackFetch(). Middleware tracking supported with our edge-compatible wrapper.
Verify everything is working with a single command
npx outboundiq-testFree tier available. No credit card required.