Nitro v3 is Coming, and I'm Excited
Nitro v3 is around the corner, and it comes packed with stuff I've been wanting for a while.
HumanOnlyWeb
🍁 writer of code. drinker of coffee. human on the web.Nitro v3 is around the corner, and it comes packed with stuff I've been wanting for a while.
Comments sections can attract spam, harassment, and bad-faith arguments. I wanted moderation tools that let me act quickly without destroying conversation context.
When you click a reaction button, you don't want to wait 200ms for the server to confirm it worked. The UI should respond immediately. But what if the server fails?
WebSockets are the usual choice for real-time features. But for a comments section, they felt like overkill.
Nested comments sound simple. Store a parentId, query by it, done. Then you try to paginate a threaded discussion and realize it's not that straightforward.
I could have just embedded Disqus and called it a day. But I did what every normal developer does when they want to add a feature: roll my own commenting system from scratch.
I added caching to an admin endpoint and it broke authentication, and almost leaked user session.
As your fullstack Nuxt app grows, you'll need more structure than just routes calling the database directly. Here's a layered architecture that scales with complexity.
Catch invalid route parameters before they hit your backend. Here's how to validate them client-side using Zod and Nuxt's definePageMeta.
Stop writing manual validation logic in every API route. Here are some utility functions that make Zod validation painless in Nuxt.
Wrangler 3+ removed the ability to easily emulate public R2 buckets locally. Here's a simple Nuxt server route workaround.