Project

spikard

0.02
A long-lived project that still receives updates
Spikard is a Rust-centric multi-language HTTP toolkit providing a high-performance core library and language bindings (Python, Node.js, Ruby, PHP, WebAssembly) to build and validate typed web services. The Ruby binding uses Magnus for zero-overhead FFI, providing Sinatra-style routing, full async/await support, WebSockets, Server-Sent Events, request validation with JSON Schema and dry-schema, lifecycle hooks, dependency injection, and comprehensive middleware stack (compression, rate limiting, authentication). Features: - Zero-copy Rust-to-Ruby serialization via Magnus - Async-first with Tokio and Axum backing - Type-safe RBS type definitions for Steep - Tower-HTTP middleware stack - Lifecycle hooks (onRequest, preValidation, preHandler, onResponse, onError) - Built-in WebSocket and SSE support - Request validation with JSON Schema
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Spikard

Rust-centric, codegen-first framework for building typed web services and generating idiomatic server scaffolds for Python, TypeScript, Rust, Ruby, PHP, and Elixir.

Features

  • Codegen-first CLI for OpenAPI 3.1, AsyncAPI 3.0, OpenRPC/JSON-RPC, GraphQL, and Protobuf/gRPC
  • Agent-friendly MCP server with CLI-equivalent project init and code generation tools
  • Real starter projects via spikard init for Python, TypeScript, Rust, Ruby, PHP, and Elixir
  • Shared Rust runtime with Tower HTTP middleware, WebSockets, SSE, and gRPC support
  • Quality-validated output with formatter, syntax, and lint/type checks for generated code

Supported Languages

Language Runtime / Toolchain Package Manager
Rust 1.85+ cargo
Python 3.10+ pip / uv
TypeScript 5.x npm / pnpm / yarn
Ruby 3.2+ gem / bundler
PHP 8.2+ composer
Elixir 1.18+ / OTP 27+ mix / hex

Installation

cargo install spikard-cli

Quick Start

Install the CLI, scaffold a real project, and generate typed handlers:

spikard init my_api --lang python --dir .
cd my_api
uv sync
uv run python -m my_api.app

Generate code from a schema with the current command surface:

# OpenAPI 3.1
spikard generate openapi examples/schemas/auth-service.openapi.yaml --lang python --output ./generated.py

# GraphQL
spikard generate graphql examples/schemas/social.graphql --lang typescript --output ./src/generated.ts

# Protobuf / gRPC
spikard generate protobuf examples/schemas/user-service.proto --lang rust --output ./src/generated.rs

MCP

The CLI ships with an MCP server by default, exposing the same init and code generation surface over stdio:

spikard mcp

That MCP surface includes init_project, generate_openapi, generate_asyncapi_handlers, generate_jsonrpc, generate_graphql, generate_protobuf, generate_asyncapi_fixtures, generate_asyncapi_test_app, generate_asyncapi_bundle, validate_asyncapi, and get_features.

For HTTP transport, build or install with the mcp-http feature and run:

cargo run -p spikard-cli --features mcp-http -- mcp --transport http --host 127.0.0.1 --port 3001

Code Generation Support

Format Generated Targets
OpenAPI 3.1 Python, TypeScript, Rust, Ruby, PHP, Elixir
AsyncAPI 3.0 Python, TypeScript, Rust, Ruby, PHP, Elixir
OpenRPC / JSON-RPC Python, TypeScript, Rust, Ruby, PHP, Elixir
GraphQL SDL / introspection Python, TypeScript, Rust, Ruby, PHP, Elixir
Protobuf / gRPC Python, TypeScript, Rust, Ruby, PHP, Elixir

All generated output is validated before write-out, and spikard init starter projects now produce real, idiomatic project layouts for every supported binding.

Performance

Benchmarked across 34 workloads at 100 concurrency (methodology):

Framework Avg RPS P50 (ms) P99 (ms)
spikard-rust 64,516 1.43 3.93
spikard-bun 49,460 2.18 4.21
spikard-node 46,160 2.18 3.35
spikard-php 16,942 5.82 9.1
spikard-python 12,623 5.55 38.39
spikard-ruby 7,151 14.62 18.98

Spikard is benchmarked against mature framework baselines across the supported bindings.

Key optimizations:

  • Thin bindings over a shared Rust core
  • Zero-copy FFI paths where the binding supports them
  • Template-driven code generation validated before files are written

Development

Use the task runner to keep the workspace aligned with CI:

task setup
task build
task test
task lint
task readme:validate

The authoritative README set is template-driven from scripts/readme_config.yaml, scripts/readme_templates/, and scripts/readme_content/.

Related READMEs

  • CLI - init, generate, testing, validate-asyncapi, and MCP
  • Rust crate - runtime API and tower-based HTTP stack
  • Python package - PyO3 bindings and Python-first usage
  • Node package - napi-rs bindings for TypeScript and Node.js
  • Ruby package - Magnus bindings and Ruby DSL
  • PHP package - ext-php-rs bindings and PHP framework API
  • Elixir package - Rustler bindings and Elixir router API

Documentation

License

MIT - See LICENSE for details