goldziher/spikard
最新稳定版本:v0.15.6-rc.16
Composer 安装命令:
pie install goldziher/spikard
包简介
Rust-centric multi-language HTTP framework with polyglot bindings
README 文档
README
Rust-centric polyglot HTTP framework with type-safe routing, OpenAPI/AsyncAPI/GraphQL/JSON-RPC codegen, tower-http middleware, and fixture-driven cross-language testing. Single Rust core compiled to 15 languages through alef-generated bindings.
Powered by Rust. Native performance for HTTP routing, validation, and middleware. Write once, bind everywhere.
Key Features
- Type-safe across bindings - HTTP routing with path, query, body, and header validation. Errors convert losslessly between languages.
- Polyglot bindings - Python, TypeScript/Node, Ruby, PHP, Elixir, Go, Java, C#, Kotlin, Dart, Swift, Zig, WASM, Rust, and C FFI.
- Fixture-driven testing - shared JSON fixtures drive tests across language bindings for behavioral consistency.
- Schema codegen - parse OpenAPI 3.0, AsyncAPI 3.0, GraphQL SDL, and JSON-RPC 2.0 specs. Generate handlers and validators per binding.
- SQL to HTTP codegen - annotate SQL queries with
@http GET /path,@http_auth bearer:jwt, and emit route metadata, OpenAPI 3.1 specs, and sidecars. - Tower middleware - compression, rate limiting, timeouts, request IDs, authentication, and static file serving.
- Lifecycle hooks -
onRequest,preValidation,preHandler,onResponse, andonError. - WebSocket, SSE, background tasks - bidirectional and server-sent streams plus fire-and-forget background jobs.
- CLI and MCP server - initialize projects, generate code, validate schemas, and integrate with MCP-compatible tools.
Installation
Each binding ships through its native package manager. Use the package README for platform requirements and build details.
| Target | Package | README |
|---|---|---|
| Rust | spikard on crates.io |
crates/spikard |
| Python | spikard on PyPI |
packages/python |
| Node.js | @spikard/node on npm |
crates/spikard-node |
| WASM | @spikard/node-wasm on npm |
crates/spikard-wasm |
| Ruby | spikard on RubyGems |
packages/ruby |
| PHP | goldziher/spikard on Packagist |
packages/php |
| Elixir | spikard on Hex |
packages/elixir |
| Go | github.com/Goldziher/spikard |
packages/go |
| Java | dev.spikard:spikard on Maven Central |
packages/java |
| C# | Spikard on NuGet |
packages/csharp |
| Kotlin | dev.spikard:spikard on Maven Central |
packages/kotlin |
| Dart | spikard on pub.dev |
packages/dart |
| Swift | Spikard through SwiftPM |
packages/swift |
| Zig | spikard through build.zig.zon |
packages/zig |
| C FFI | spikard-ffi shared/static library |
crates/spikard-ffi |
Quick Start
Python
from spikard import Spikard from spikard.config import ServerConfig from msgspec import Struct class User(Struct): id: int name: str app = Spikard() @app.get("/users/{id:int}") async def get_user(id: int) -> User: return User(id=id, name="Alice") if __name__ == "__main__": app.run(config=ServerConfig(port=8000))
TypeScript
import { Spikard, ServerConfig } from "@spikard/node"; const app = new Spikard(); app.get("/users/{id:int}", async (id: number) => { return { id, name: "Alice" }; }); const config = new ServerConfig({ port: 8000 }); app.run(config);
Architecture
All bindings call a shared Rust core through thin language-native layers:
Language bindings (Python, Node, Ruby, Go, Java, C#...)
|
v
FFI / NAPI / PyO3 / Magnus / runtime bridge
|
v
crates/spikard-http Router, middleware, auth
crates/spikard-core HTTP types, validation, errors
crates/spikard-codegen OpenAPI, GraphQL, AsyncAPI, JSON-RPC
Bindings are generated from the Rust API surface via alef. Binding code stays thin: type conversion, error conversion, and runtime integration.
Development
task setup
task build
task test
task test:e2e
task lint
task format
Run task --list for the full task catalog.
Project Status
- Rust core is stable.
- Binding packages follow the Rust crate version.
- E2E coverage is fixture-driven and shared across supported language targets.
Contributing
See CONTRIBUTING.md. Generated binding and e2e files should be changed through Rust source, fixtures, templates, or alef.toml.
License
MIT License - see LICENSE for details.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 102
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-26