MCPcopy Index your code
hub / github.com/Goldziher/spikard

github.com/Goldziher/spikard @v0.16.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.16.1 ↗ · + Follow
20,031 symbols 106,382 edges 1,426 files 4,546 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

spikard - polyglot web toolkit

One web toolkit, every language.

Rust-centric polyglot web toolkit. Single Rust core compiled to 15 languages through alef-generated bindings — type-safe routing, OpenAPI/AsyncAPI/GraphQL/JSON-RPC codegen, tower-http middleware, and fixture-driven cross-language testing.

Rust core · Python · TypeScript · Ruby · PHP · Elixir · Go · Java · C# · Kotlin · Dart · Swift · Zig · WASM · C FFI

Built with alef

Rust Python Node.js WASM Ruby PHP Elixir Java Go C# Kotlin Dart Swift Zig C FFI Homebrew

License GitHub Stars

Install · Why spikard · Quick example · Docs


Why spikard

Capability Details
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.
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 and OpenAPI specs.
Tower middleware Compression, rate limiting, timeouts, request IDs, JWT/API-key auth, and static file serving.
Lifecycle hooks onRequest, preValidation, preHandler, onResponse, and onError.
WebSocket & SSE Bidirectional streams and server-sent events.
Fixture-driven testing Shared JSON fixtures drive tests across language bindings for behavioral consistency.
CLI & MCP server Initialize projects, generate code, validate schemas, and integrate with MCP-compatible tools.

Installation

Each binding ships through its native package manager.

Target Package Install
Rust spikard on crates.io cargo add spikard
Python spikard on PyPI pip install spikard
Node.js @spikard/node on npm npm install @spikard/node
WASM @spikard/node-wasm on npm npm install @spikard/node-wasm
Ruby spikard on RubyGems gem install spikard
PHP goldziher/spikard on Packagist composer require goldziher/spikard
Elixir spikard on Hex Add {:spikard, "~> 0.1"} to mix.exs
Go github.com/Goldziher/spikard go get github.com/Goldziher/spikard
Java dev.spikard:spikard on Maven Central Maven/Gradle — see Java README
C# Spikard on NuGet dotnet add package Spikard
Kotlin dev.spikard:spikard on Maven Central Maven/Gradle — see Kotlin README
Dart spikard on pub.dev dart pub add spikard
Swift Spikard via SwiftPM Add to Package.swift
Zig spikard via build.zig.zon Add to build manifest
C FFI spikard-ffi shared/static library GitHub Releases

Quick example

Python

from spikard import Spikard
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(port=8000)

TypeScript

import { Spikard } from "@spikard/node";

const app = new Spikard();

app.get("/users/{id:int}", async (id: number) => {
  return { id, name: "Alice" };
});

app.run({ port: 8000 });

More examples (Ruby · PHP · Elixir · Go · Java · C# · Kotlin · Dart · Swift)

See the examples directory in the repository for working examples in every supported language.

Architecture

All bindings call a shared Rust core through thin language-native layers:

How bindings work

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. Business logic, validation, middleware, and codegen all live in Rust.

Specification support

  • OpenAPI 3.0 — Route definitions to specs, parameter validators, Swagger/ReDoc UI
  • GraphQL — SDL schema parsing, query execution, introspection, Handler trait integration
  • AsyncAPI 3.0 — Channel/operation extraction, message validators, WebSocket integration
  • OpenRPC — JSON-RPC 2.0 method handlers, parameter validation, batch requests

Middleware stack

Compression (gzip/brotli), rate limiting, timeouts, request IDs, authentication (JWT/API key), static files. Configured via ServerConfig structs. All middleware is implemented in Rust via tower-http.

Development

task setup     # Install dependencies
task build     # Build Rust core (debug)
task test      # Run Rust tests
task test:all  # Run all tests (Rust + bindings)
task e2e:all   # Generate + build + run e2e tests
task format    # Format all code

Run task --list for the full task catalog.

Project status

  • Rust core is stable and production-ready.
  • Binding packages follow the Rust crate version.
  • E2E coverage is fixture-driven and shared across supported language targets.
  • See CONTRIBUTING.md for guidelines on modifying generated bindings.

License

MIT License — see LICENSE for details.

Extension points exported contracts — how you extend this code

ProjectScaffolder (Interface)
Language-agnostic trait for scaffolding new Spikard projects. Implementations define how to create the initial project [6 …
crates/spikard-cli/src/init/scaffolder.rs
Handler (Interface)
Handler trait that all language bindings must implement This trait is completely language-agnostic. Each binding (Pytho [53 …
crates/spikard-http/src/handler_trait.rs
NativeLifecycleHook (Interface)
Trait for lifecycle hooks on native targets (Send + Sync, Send futures). [9 implementers]
crates/spikard-core/src/lifecycle.rs
Callable (Interface)
Functional interface for service handlers. Implementations receive a JSON request string and return a JSON response str [5 …
packages/java/src/main/java/dev/spikard/Callable.java
SecuritySchemeInfo (Interface)
SecuritySchemeInfo security scheme types Variants: Http, ApiKey Sealed interface -- use one of SecuritySchemeInfoHttp, S [2 …
packages/go/binding.go
IntoHandler (Interface)
Convert user-facing handler functions into the low-level `Handler` trait. [2 implementers]
crates/spikard/src/lib.rs
TestClientRenderer (Interface)
Per-language `TestClient` test renderer. Implementations live alongside the per-language codegen module (`crates/alef-e [1 …
crates/spikard-e2e-http/src/driver/mod.rs
ProtobufGenerator (Interface)
Language-agnostic Protobuf code generator trait Implementations provide language-specific code generation for: - Messag [6 …
crates/spikard-cli/src/codegen/protobuf/generators/mod.rs

Core symbols most depended-on inside this repo

to_string
called by 4638
packages/swift/rust/src/lib.rs
header
called by 4089
crates/spikard/src/lib.rs
build
called by 3393
crates/spikard-http/src/lib.rs
method
called by 3360
crates/spikard/src/lib.rs
create
called by 3352
crates/spikard-http/src/server/routing_factory.rs
statusCode
called by 3348
packages/php/stubs/spikard_php_extension.php
get
called by 2687
packages/ruby/sig/service.rb
clone
called by 2366
crates/spikard-py/src/lib.rs

Shape

Method 9,022
Function 8,990
Class 1,837
Enum 100
Struct 60
Interface 20
FuncType 1
TypeAlias 1

Languages

Rust45%
Kotlin13%
Java9%
C#8%
Python7%
PHP7%

Modules by API surface

crates/spikard-ffi/src/lib.rs313 symbols
crates/spikard-php/src/lib.rs256 symbols
packages/swift/rust/src/lib.rs254 symbols
crates/spikard-wasm/src/lib.rs213 symbols
packages/ruby/ext/spikard_rb/src/lib.rs212 symbols
crates/spikard-py/src/lib.rs127 symbols
packages/elixir/lib/lib.rs121 symbols
test_apps/elixir/deps/spikard/lib/lib.rs120 symbols
packages/php/stubs/spikard_php_extension.php120 symbols
crates/spikard-node/src/lib.rs112 symbols
packages/dart/rust/src/lib.rs108 symbols
packages/csharp/src/Spikard/NativeMethods.cs107 symbols

Datastores touched

mydbDatabase · 1 repos
appDatabase · 1 repos

For agents

$ claude mcp add spikard \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page