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

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

Coffee Tracker: Exploring Bun's SQLite Integration, Shell API, and v1.1 updates

With the Bun reached 1.0 last year and recent release of Bun 1.1, JavaScript developers have a lot to be excited about. Windows support is a big headline feature, but there are several less-heralded improvements that make daily development significantly smoother. Today, we’ll explore two standout features: the built-in SQLite database and the Bun Shell API. To showcase these features in action, we’ll build a simple coffee consumption tracker. It’s a toy example that demonstrates how these tools simplify everyday development tasks. ...

May 4, 2024 · 9 min · 1784 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

Embracing Interaction to Next Paint (INP) for Better Web Responsiveness

The Evolving Nature of Web Vitals For web perf professionals, ones become familiar with Google’s Core Web Vitals. These metrics have fundamentally changed how we approach performance optimization, shifting focus from technical measurements to metrics that better reflect real user experiences. As real-world usage patterns evolve and browser capabilities advance, these metrics need to evolve too. That’s the role Interaction to Next Paint (INP) plays. Announced earlier this year, INP is Google’s experimental metric designed to better measure a page’s overall responsiveness to user interactions. More importantly, it’s positioned to replace First Input Delay (FID) as a Core Web Vital next year, so understanding it now will give you a significant head start. ...

October 11, 2023 · 6 min · 1117 words · Dennis Lin