Next.js guide
Activity log or audit log for Next.js: your options
Next.js has no built-in activity log, and there is no single standard package for one. Teams usually pick one of the approaches below, depending on whether they need record history, analytics, error tracking, an audit log for their own customers, or a readable story of what happened.
The short answer
| You need | Good fit |
|---|---|
| A history of changes to a few tables, in your own database | Your own audit table, or Postgres triggers |
| Funnels, retention and how people use the product | Product analytics such as PostHog |
| Errors and slow requests, for engineers | Sentry or another error tracker |
| An audit log you show to your enterprise customers | WorkOS Audit Logs or similar |
| A plain-English feed of everything that happened (routes, Server Actions, database changes and jobs together) that anyone on the team can read, and that AI assistants can query | EZLogs |
Your own audit table
Create an audit_log table and write a row from your Server Actions and route handlers, or centrally with a Prisma Client extension or your own wrapper around Drizzle queries. You control every field and the data stays in your database.
The cost: you write and maintain it, and anything you forget to log is missing. Changes made outside your ORM (a script, the database console, another service) are not recorded unless you add them.
Postgres triggers
A trigger records every insert, update and delete on a table, whatever made the change. Supabase’s open-source supa_audit showed the pattern (one SQL call per table), but it was archived in February 2025, so copy its trigger approach rather than install it.
Pick it when you want complete row history in your own database. It does not tell you which request or user caused a change unless you pass that in yourself, and the rows are data for developers.
Product analytics (PostHog and others)
PostHog and similar tools record page views and the events you send, and turn them into funnels, trends and recordings.
Pick it when you want to understand usage in aggregate. It is not a record of what changed in your database. It sees what happens in the browser plus the events you send.
Error tracking (Sentry and others)
Sentry captures exceptions and performance traces so engineers can fix them.
Pick it when you need to debug. It is built around errors and performance, for engineers, not as a plain-language story for support or product.
Audit logs for your customers (WorkOS and others)
WorkOS Audit Logs and similar services store events you send from your code and let your enterprise customers view or export their own audit trail.
Pick it when your customers ask for an audit log as a feature. You still choose and send each event yourself.
EZLogs
EZLogs is a hosted activity log for your own team. The ezlogs-nextjs package captures routes and Server Actions on its own; Postgres changes after one command (npx ezlogs-nextjs install-triggers); and background jobs with one wrapper per queue (BullMQ, Inngest, Trigger.dev, Upstash, Supabase Queues). EZLogs links them by request and record, then shows one plain-English card per action: “Refund failed: card expired”, with who did it (a person, an AI agent or the system) and which records it touched. You can also connect Claude, ChatGPT or Cursor over MCP and ask what happened.
Trade-offs, honestly:
- Data leaves your app. It is sent to EZLogs servers in Germany (EU), after sensitive parameters and columns are masked or removed. A homemade table or triggers keep everything in your own database.
- EZLogs is read-only. It explains what happened; it cannot restore old rows.
- History is kept for 90 days during the beta. For a long-term compliance trail, keep your own audit table as well.
- It is not a customer-facing audit log product like WorkOS.
- It is a hosted service. It is free during the beta, and the agent is open source; the server is not self-hostable yet.
Try EZLogs on your Next.js app
npm install ezlogs-nextjs
Then add ezlogs.init() to instrumentation.ts and wrap your Next config. The full steps are on the Next.js page, and there is a copy-paste prompt for your coding AI at app.ezlogs.io/install/nextjs.md.
No card required · Read-only by design