Skip to content

Instantly share code, notes, and snippets.

View chengyixu's full-sized avatar
💭
I may be slow to respond.

Wilson Xu chengyixu

💭
I may be slow to respond.
View GitHub Profile
@chengyixu
chengyixu / htmx-vs-react-when-to-use-20260512.md
Created May 12, 2026 05:01
htmx vs React: When to Use Each -- practical comparison guide with decision matrix, real production examples, and migration strategies

htmx vs React: When to Use Each in 2026

The frontend framework debate has shifted. It's no longer React vs Vue vs Angular -- it's React (and its SPA cohort) vs htmx and the hypermedia-driven resurgence. After building production applications with both, here's a practical guide to choosing the right tool.

The Fundamental Difference

React is a client-side rendering library. You ship JavaScript, it builds the DOM, manages state, and orchestrates interactions. htmx extends HTML with attributes that let any element make HTTP requests and swap the response into the DOM without writing JavaScript.

React says: "Your server sends JSON, the browser builds the UI." htmx says: "Your server sends HTML, the browser swaps it in."

@chengyixu
chengyixu / typescript-template-literal-types-api-safety-20260505.md
Created May 11, 2026 17:40
Mastering TypeScript Template Literal Types for API Type Safety — 2,376 words, practical patterns for building bulletproof API layers with template literal types

Mastering TypeScript Template Literal Types for API Type Safety

Author: Cheng Yi Xu Date: May 5, 2026 Word Count: ~2,400


In 2026, TypeScript has become the undisputed standard for building type-safe applications. Yet most developers are still using only a fraction of its type system. One of the most powerful and underutilized features is template literal types -- introduced in TypeScript 4.1 and drastically improved in every release since. When applied to API type safety, template literal types eliminate entire categories of runtime errors before your code ever hits production.

@chengyixu
chengyixu / webassembly-js-developers-guide-2026.md
Created May 9, 2026 08:57
WebAssembly for JavaScript Developers: A Practical Guide to Running Native Code in the Browser (2026)

WebAssembly for JavaScript Developers: A Practical Guide to Running Native Code in the Browser

Word count: ~2,600


WebAssembly (Wasm) is no longer a curiosity — it's a production technology powering Figma, Photoshop for Web, Google Earth, 1Password, and thousands of other applications. In 2026, WebAssembly has reached mainstream maturity with full browser support, first-class tooling, and emerging standards like the Component Model. Yet many JavaScript developers still think of it as "that thing for porting C++ to the web."

This guide is different. We'll build practical WebAssembly modules from scratch using Rust, integrate them with JavaScript, benchmark real performance gains, and cover the production patterns that teams at Figma and Adobe have battle-tested.

@chengyixu
chengyixu / event-sourcing-typescript-audit-20260509.md
Created May 9, 2026 08:38
Event Sourcing in TypeScript: Building Audit Trails with Append-Only Event Stores

Event Sourcing in TypeScript: Building Audit-Ready Systems

Author: Chengyi Xu Date: 2026-05-09 Target: LogRocket / SitePoint / Smashing Magazine Status: ready


Picture this: your payment service processed a refund twice. The customer is angry, the finance team is confused, and nobody can tell you exactly what happened because the state says "refunded" and your audit log was a best-effort afterthought that someone forgot to update in the second code path. If this scenario keeps you up at night, you need event sourcing.

@chengyixu
chengyixu / building-cli-tools-typescript-20260509.md
Created May 9, 2026 08:32
Building CLI Tools in TypeScript: From Script to Product - production CLI patterns with Commander, structured concurrency, config cascade, and npm publishing

Building CLI Tools in TypeScript: From Script to Product

Word Count: ~3,100 | May 9, 2026


Every developer has a folder called scripts/. Inside: a dozen .ts files that solve real problems but will never be shared. They lack argument parsing, error handling, tests, and distribution. A script becomes a product when another developer can npm install -g it and have it work on the first try.

TypeScript has matured into a first-class CLI language. Node.js 24 ships with native TypeScript support via type stripping. The ecosystem around CLI construction -- argument parsing, output formatting, configuration management, testing -- has converged on production-tested patterns. This article walks through building a CLI tool that another engineer would pay for, not just one that runs on your machine.

@chengyixu
chengyixu / react-19-compiler-auto-memoization-20260509.md
Created May 9, 2026 08:22
The React 19 Compiler: How Automatic Memoization Changes Everything — complete draft (2,371 words)

The React 19 Compiler: How Automatic Memoization Changes Everything

Author: Chengyi Xu Date: 2026-05-09 Word Count: ~2,800 Target: SitePoint / Smashing Magazine / LogRocket


Introduction

@chengyixu
chengyixu / building-cli-tools-typescript-20260509.md
Created May 9, 2026 08:22
Building CLI Tools in TypeScript: From Script to Product — complete draft (3,642 words)

Building CLI Tools in TypeScript: From Script to Product

Word Count: ~3,100 | May 9, 2026


Every developer has a folder called scripts/. Inside: a dozen .ts files that solve real problems but will never be shared. They lack argument parsing, error handling, tests, and distribution. A script becomes a product when another developer can npm install -g it and have it work on the first try.

TypeScript has matured into a first-class CLI language. Node.js 24 ships with native TypeScript support via type stripping. The ecosystem around CLI construction -- argument parsing, output formatting, configuration management, testing -- has converged on production-tested patterns. This article walks through building a CLI tool that another engineer would pay for, not just one that runs on your machine.

@chengyixu
chengyixu / railway-oriented-typescript-20260509.md
Created May 9, 2026 08:20
Railway-Oriented Programming in TypeScript — beyond try/catch with neverthrow and Effect-TS

Beyond try/catch: Railway-Oriented Programming in TypeScript for Reliable Backends

Introduction

Every production outage I've debugged in the past three years shares one root cause: an unhandled exception somewhere in the call stack that propagated silently, corrupted state, or crashed the process entirely. A database connection dropped mid-transaction. An external API returned an unexpected shape. A file that should have existed didn't. In each case, the code relied on try/catch blocks scattered across the codebase like bandaids -- and each time, something slipped through.

The problem with try/catch is not that it fails to catch errors. It's that try/catch treats errors as a separate control flow mechanism, invisible to the type system and invisible to anyone reading the function signature. You look at function processOrder(id: string): Order and have no idea it can fail. The compiler won't warn you. Your IDE won't autocomplete the error case. The only way to know is to read the implementation or wa

@chengyixu
chengyixu / postgres-for-frontend-devs-20260507.md
Created May 9, 2026 08:19
PostgreSQL for Frontend Developers: A Practical Guide to Queries, Indexing, and Schema Design

title: "Postgres for Frontend Developers: The Database You Can't Avoid in 2026" estimated_rate: "$400-500" target_outlets:

@chengyixu
chengyixu / react-19-compiler-auto-memoization-20260509.md
Created May 9, 2026 08:19
The React 19 Compiler: How Automatic Memoization Replaces useMemo, useCallback, and React.memo

The React 19 Compiler: How Automatic Memoization Changes Everything

Author: Chengyi Xu Date: 2026-05-09 Word Count: ~2,800 Target: SitePoint / Smashing Magazine / LogRocket


Introduction