Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Next.js app demonstrating unified client and server logging with Pino to Logflare.
The Next.js Pino Logflare Logging Example is a boilerplate Next.js application that demonstrates unified client-side and server-side logging to Logflare using the pino and pino-logflare libraries.
This is a Next.js project bootstrapped with create-next-app, maintained by Logflare on GitHub. It provides a single logger interface configured in logger/logger.js that sends both client and server logs to Logflare. The repository includes runnable examples for logging from API routes and the browser, and it is designed to be deployed to Vercel with the Logflare integration.
logger/logger.js uses pino and pino-logflare to handle logging from both Node.js and browser environments.pages/api directory to see different ways to log data and errors from API endpoints.pages/index.js file demonstrates how pino-logflare captures browser console logs and sends them to Logflare.The project uses pino as the logger on the server and pino-logflare as the transport that forwards logs to Logflare's API. In the browser, pino-logflare captures client-side events and sends them to the same Logflare source. After deploying to Vercel, you must visit the Logflare integrations page and set up a log drain to receive platform logs.
The repository is publicly available on GitHub, so the code is free to use. Logflare's service and Vercel hosting have their own pricing, which may apply depending on your usage.
The Vercel deploy flow installs the Logflare integration automatically. After deployment, you need to create a log drain from your Logflare account to start receiving logs. A link to manage log drains is provided in the README.
Yes. The example shows server-side logging from API routes and client-side logging from the browser, all unified through the pino-logflare configuration.
pino-logflare is a pino transport that sends logs to Logflare. It enables a single logger interface to work across Node.js and browser environments, forwarding logs to Logflare's ingestion API.
