Hasty Briefsbeta

Bilingual

MerJS: A Zig-native web framework that ships without Node

11 hours ago
  • #Performance Optimization
  • #Full-Stack Development
  • #Web Framework
  • The framework uses a filesystem-based structure for pages, APIs, layouts, and 404 handling, with app/ for SSR pages and api/ for typed JSON responses.
  • It supports file-based routing, SSR, type-safe APIs, hot reload, Cloudflare Workers deploys, and client-side WASM, achieving high performance (115,093 req/s locally) with low resource usage (4.8 MB RAM under CI load).
  • The framework eliminates JavaScript-first assumptions, using Zig structs and comptime validation to remove extra schema layers and reduce code-drift between the code and transport layers.
  • It allows rendering full pages, streaming chunks, or splitting layout shells from bodies without requiring React for patterns, and can compile client logic directly to WASM for a unified language end-to-end.
  • Development features include an in-process file watcher with SSE for updates (no JS bundler or devtools agent), prerendering for static HTML generation, and path params in routes typed and available on request structs.
  • Security is built-in with default signed and encrypted configurations (no external services like Redis or JWT libraries), and static files in public/ are cached in memory with MIME types and ETags handled automatically.
  • Styling is optimized by scanning templates at compile time to emit only used CSS classes, supporting Tailwind-like utilities without requiring Tailwind or PostCSS.
  • Telemetry is integrated into the framework, allowing custom sinks (e.g., stdout, OTLP, Sentry) without altering request paths, and the same Zig source compiles to native binaries or WASM for deployment across multiple platforms.
  • The approach focuses on keeping beneficial features like routing, layouts, hot reload, and edge deploys while removing unnecessary layers tied to JavaScript, resulting in faster startup, lower latency, and smaller binaries.