What We Learned Building a Rust Runtime for TypeScript
Summary
A deep technical overview of Encore's Rust-based runtime for TypeScript, detailing why they built a Rust core, how the core runtime interacts with JavaScript via NAPI, and how they achieve in-process performance for routing, database access, pub/sub, and tracing. The article covers architecture decisions, error handling improvements, in-process API gateway with Pingora, and the challenges of cross-language promises and cancellation. It also shares benchmarks, parsing of TypeScript, and lessons learned.