Hypha Tech 在 Hacker News 上展示了 Spindle,这是一款专为 OCaml 5 打造的全功能、类型安全的 Web 框架 1。该框架基于多核架构并原生支持 eio,旨在通过类型驱动的 API 自动派生编解码器、请求验证、OpenAPI 规范以及前端模式(包括 Zod 和 Melange),从而确保服务器端与客户端契约的同步 1。除了核心的类型安全特性外,Spindle 还内置了符合 RFC 标准的严格 HTTP 服务器、可组合依赖系统、WebSockets、SSE 以及用于构建 MCP 服务器的高级原语 1。
在生产就绪能力方面,Spindle 提供了分布式追踪、OpenTelemetry 兼容指标和日志记录等功能 1。根据基准测试结果,该框架在单核环境下运行速度比 NestJS 快两倍,比 FastAPI 快五倍 1。开发者可以通过官方文档链接 https://hyphatech.github.io/spindle/ 获取更多技术细节和使用指南 1。
Hypha Tech has released Spindle, a comprehensive and type-safe web framework designed specifically for OCaml 5 1. The framework is built on a multi-core architecture with native support for the eio concurrency library 1. By leveraging type-driven APIs, Spindle automatically generates codecs, request validations, OpenAPI specifications, and frontend schemas compatible with tools like Zod and Melange, ensuring that server and client contracts remain synchronized 1.
In addition to its core typing features, Spindle provides production-ready capabilities including an RFC-compliant strict HTTP server, composable dependencies, WebSockets, Server-Sent Events (SSE), and high-level primitives for building MCP servers 1. It also supports distributed tracing, OpenTelemetry-compatible metrics, and logging to aid in operational monitoring 1. According to benchmark tests cited in the announcement, Spindle runs twice as fast as NestJS and five times faster than FastAPI in single-core configurations 1. Official documentation for the framework is available at https://hyphatech.github.io/spindle/ 1.
评论
还没有评论,欢迎留下第一条。