G
YouTube TikTok Games
Skip to content
View claviron's full-sized avatar

Block or report claviron

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
claviron/README.md

Claviron logo

Claviron

Move to Rust at your own pace

Claviron is an application-first toolkit for building and running services. Run Rust alongside your existing applications. Keep them together as a modular monolith or distribute them across independent processes.

Build your own Edge and serve public traffic directly. Terminate TLS, route requests, serve files, and dispatch to your applications at the Edge. Your application controls every layer, from listeners and access rules to handlers and response policies. Enable what you need. An omitted layer adds no work per request.

Fleet awareness

Taste the power of Orbit. Drop the sockets between sibling applications on the same host. No dial. The connection starts with the runtime. As each application boots, it joins its Orbit fleet. Peers exchange requests and events directly through shared memory. Orbit uses futexes, umtx, and shared address waits.

Fleet awareness · Orbit Link

The same Axum app served 2.57× as many responses per second through Orbit Link as through Caddy's HTTP/1.1 reverse proxy, using 63% less CPU per response across the frontend and app. All three paths passed the same 128-connection HTTP/1.1 load phase with zero errors.

Path to Axum Responses/s Combined CPU/response
Caddy → HTTP/1.1 upstream 60,058 296.23 µs
Claviron Edge → HTTP/1.1 upstream 118,736 128.17 µs
Claviron Edge → Orbit Link 154,190 108.30 µs

Axum proxy benchmark and methodology

Move to Rust without a full rewrite

Keep your application behind Claviron and add a Rust intercept for the first route you want to move. Claviron runs the Rust handler first. Requests it leaves unhandled continue to the existing application. You can move one API, a hot path, or a security check at a time while keeping the public URL and host policies.

Start with a route that benefits from Rust's type and memory safety, or one where you want to reduce latency or CPU use. Claviron can run the new Rust code alongside your PHP, Python, JavaScript, Go, Java, or C/C++ application. Each part can keep its existing runtime and move on its own schedule.

Design contracts

Build your own Edge

Start with the Edge example or the Edge configuration guide.

Add ACME certificate automation and gRPC administration with typed service registration. DNS plugs into the same lifecycle through its registration function. Use compatible releases of the three backend crates and enable their server features.

async fn main() -> Result<()> {
    Server::new()
        .config_dir("config")
        .workers(Workers::Available)
        .with_services::<(AcmeService, GrpcAdmin)>()
        .register(claviron_dns::register)
        .serve()
        .await
}

ACME · gRPC administration · DNS · Runnable examples

Bring your application

Put boundaries where they belong

TLS first. Require mutual TLS on the virtual host that needs it. On a TLS listener, the Edge verifies client certificates during the handshake, before any request reaches your application.

admin.example.test:
  transport:
    non_ssl: reject
  tls:
    client_auth:
      mode: required
      ca_bundle: certs/client-ca.pem

Register a route extension

Let your Edge apply CORS and verify CSRF before a request reaches embeded scripts.

routes:
  /account:
    csrf: true

Watch configuration with Congif. Enable config-watch for native file notifications on watched sources. A change to a single setting can trigger reload. Claviron validates and prepares the candidate before atomically publishing the new snapshot. Invalid edits leave the active snapshot in place.

Congif · Binding and reload

Serve static files at the Edge

Mount asset directories, serve directory indexes, and configure try_files or an SPA fallback. Large files stream from disk with backpressure. Small files can be cached in memory and shared across workers when the fleet cache is enabled.

Capability HTTP specification
ETag and Last-Modified, conditional requests, and single byte ranges RFC 9110 §§8.8, 13–14
Browser freshness via Cache-Control and Expires, with opt-in immutable assets RFC 9111 §5, RFC 8246
Negotiated Brotli and Zstandard representations RFC 9110 §12.5, RFC 7932, RFC 8878

Static file configuration and caching

Performance

Plain HTTP. At the highest load all three configurations passed in the same Linux HTTP/1.1 run, Claviron with Axum delivered 3.27× Caddy's throughput with 68% less server CPU per response.

Server Responses/s CPU/response
Caddy 2.11.9 268,817 74.76 µs
Claviron + Axum, 32 workers 879,753 24.09 µs

A separate run reached 1,045,500 responses/s with Claviron and Warp. Matched Caddy comparison · Warp peak

Pentaglot. Embedded libphp served 227k JSON responses/s and the C module served 306k responses/s in the same benchmark suite. The PHP route uses a persistent application with OPcache warmed at startup and runs without Composer or a framework. Pentaglot results and setup

Persistent PHP. With 128 PHP instances and 1,024 connections, both servers completed the five-minute runs without errors. Each cell shows responses per second and server CPU per response.

Workload Claviron FrankenPHP 1.13.5
Plain PHP 299,896 / 64.72 µs 90,015 / 227.23 µs
Symfony, with Skene on Claviron 88,139 / 312.43 µs 41,398 / 565.52 µs

FrankenPHP comparison · Laravel/Lumenize results

Near-native throughput with managed workers

On Linux with 1,024 HTTP/1.1 connections, Claviron Other delivered 93% of native Hyper's throughput at the highest load both passed. Its 40 supervised worker processes kept meeting the SLA up to 38,912 outstanding requests.

Server Responses/s at 16,384 outstanding Server CPU/response Last passing outstanding target
Native Hyper, 40 runtime threads 1,811,355 14.50 µs 16,384
Claviron Other, 40 worker processes 1,678,101 16.31 µs 38,912

HTTP/1.1 benchmark and methodology

With Claviron for Apple, see embedded and linked applications together and add workers from the same app.

Claviron for Apple showing running embedded and linked applications

Add Worker confirmation with eight running workers in Claviron for Apple

Crates.io · API documentation · Contributing · Security

Examples · Bench HTTP · Break

Licensed under MIT or Apache 2.0.

Popular repositories Loading

  1. gufi gufi Public

    Python runner for Claviron runtime

    Rust

  2. lumenize lumenize Public

    Safe Atomic Rust Power for PHP/Laravel applications through Claviron and Orbitive

    PHP 1

  3. exta exta Public

    Infrastructure services for Claviron

  4. tools tools Public

    Claviron operator tools

    Rust

  5. claviron claviron Public

    High-performance Rust Edge, application runtime, and zero-dial shared-memory IPC for polyglot services.

    Rust

  6. sapi sapi Public

    PHP API declarations, native runtime fallbacks, and Monolog integration for Claviron’s embedded SAPI.

    PHP