·September 18, 2025

Setting up PostHog Error Tracking for Nitro

How I set up Posthog Error Tracking for Nitro

If you're like me and absolutely love PostHog, you've probably got it set up in you frontend for analytics, error tracking, etc... You don't really want a seperate tool just for error tracking you backend or API. So, I set up PostHog Error Tracking as a Nitro plugin.

Setup

1. Install posthog-node

[@portabletext/vue] Unknown block type "jsPackageInstall", specify a component for it in the `components.types` prop

2. Create posthog.ts in ~/server/plugins/posthog.ts

[@portabletext/vue] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

Conclusion

This setup will give you PostHog error tracking in your Nitro backend. Happy coding!

Would you consider partnering with me?

A team of partners led by God in praying and giving is crucial to being a missionary.

To receive updates and prayer points ↓

Also! See more ways you can partner with me! →

© 2024 André van Tonder.