Advanced Patterns for Production-Ready SSE (continued)

Last June, I wrote “The Quiet Power of Server-Sent Events for Real-Time Apps” where I sang the praises of SSE as a lightweight alternative to WebSockets for many real-time scenarios. While the simplicity of SSE remains one of its greatest strengths, that simplicity can be deceptive. A naive implementation might work perfectly in development but crumble under the harsh realities of spotty connections, aggressive proxies, and browser quirks. Let’s dive into the techniques that transform fragile SSE connections into resilient data pipelines. ...

January 30, 2025 · 9 min · 1765 words · Dennis Lin

Svelte 5: The Comeback Story of a Revolutionary Framework

Back in early 2020, I wrote a blog post titled “Svelte 3: The Compiler as Your Framework”. Like many developers at the time, I was blown away by Rich Harris’s compiler-centric approach that promised to solve the virtual DOM overhead of React while offering a delightfully simple developer experience. The “write less code” mantra resonated with me, and for a handful of smaller projects, Svelte proven to be beyond useful. But then, as projects grew more complex and team considerations came into play, Svelte gradually slipped from my daily toolkit. The ecosystem wasn’t quite there yet. Component libraries were sparse compared to React’s thriving marketplace. Finding developers experienced with Svelte was challenging. The “real world” pushed me back toward React and occasionally Vue for client work. ...

November 16, 2024 · 8 min · 1586 words · Dennis Lin

Building an Interactive Code Syntax Highlighter with HTMX vs React

The debate between “traditional” JavaScript frameworks like React and emerging HTML-centric approaches like HTMX has been heating up in recent months. Rather than adding to the noise with abstract comparisons, I decided to build the same interactive component using both technologies to see how they really stack up in practice. The Toy Project: An Interactive Syntax Highlighter For this comparison, I wanted something more interesting than the usual todo app, but still focused enough to make a fair comparison. I settled on creating an interactive code syntax highlighter with the following features: ...

August 2, 2024 · 7 min · 1394 words · Dennis Lin

The Quiet Power of Server-Sent Events for Real-Time Apps

Introduction When building real-time web applications, WebSockets often grab the spotlight. They promise robust, bidirectional communication and are frequently the default choice discussed in architecture meetings and tech talks. Meanwhile, Server-Sent Events (SSE) sits quietly in the corner, a powerful but frequently overlooked standard that deserves more serious consideration than it typically receives, especially for specific, common use cases. I recently worked on a analytics project where the initial requirement was “real-time updates, so we need WebSockets.” It’s a common refrain. However, after digging into the actual need… streaming analytics updates to the browser with absolutely no requirement for client-to-server messages over that channel, we pivoted to SSE. The outcome? A noticeably simpler backend, less resource consumption, and a more straightforward codebase to maintain. ...

June 17, 2024 · 10 min · 2020 words · Dennis Lin

Server Actions vs API Routes in Next.js: My Journey with Both Approaches

Introduction When building full-stack applications with Next.js, one of the architectural decisions we’ve been grappling with lately is choosing between Server Actions and API Routes for server-side logic. With Server Actions becoming stable in Next.js 14, I’ve been experimenting with both approaches across different projects. I thought I’d share some observations from my recent experiences. Your mileage may vary, and I’d love to learn on how others are approaching this decision! ...

January 19, 2024 · 8 min · 1520 words · Dennis Lin