Spikard — Part of the spikard polyglot web toolkit.
Rust-centric polyglot HTTP framework with OpenAPI/AsyncAPI/GraphQL/JSON-RPC codegen, tower-http middleware, and fixture-driven cross-language testing. Elixir bindings via Rustler NIF with OTP integration.
Install · Quick example · Features · Docs
What this package provides
OTP-integrated Rustler bindings — Elixir 1.14+ with Erlang 25+ for distributed systems
Type-safe routing — HTTP definitions with path, query, body, and header validation across all bindings
Spec-driven codegen — OpenAPI 3.0, AsyncAPI 3.0, GraphQL SDL, and JSON-RPC 2.0 support
Cross-language parity — same DTOs, fixtures, and error model prevent runtime drift
Tower middleware — compression, rate limiting, timeouts, auth (JWT/API key), static files
Lifecycle hooks —
onRequest,preValidation,preHandler,onResponse,onError
Installation
Add to mix.exs:
def deps do
[
{:spikard, "~> 0.16.1"}
]
end
Run mix deps.get.
System Requirements
- Elixir 1.14+ and Erlang/OTP 25+ required
Quick example
See the spikard repository for usage examples and guides.
Features
| Feature | Support |
|---|---|
| Type-safe routing | Path, query, body, and header parameter validation |
| Request extraction | Typed structs for JSON, form data, multipart, and raw bodies |
| Spec support | OpenAPI 3.0 · AsyncAPI 3.0 · GraphQL SDL · JSON-RPC 2.0 |
| Middleware | Compression, rate limiting, timeouts, authentication, static files |
| Lifecycle hooks | Request, pre-validation, pre-handler, response, and error hooks |
| WebSocket & SSE | Bidirectional streams and server-sent events |
| Error handling | Consistent error responses across all bindings via ProblemDetails |
| Fixture testing | Shared JSON fixtures for behavioral consistency across languages |
Routing
See examples in the repository.
Validation
See examples in the repository.
Middleware & configuration
See examples in the repository.
Resources
- Repository — source code, examples, and issues
- Examples — working implementations in all supported languages
- Contributing — how to contribute
License
MIT License — see LICENSE for details.