Skip to main content

Crate ryuk

Crate ryuk 

Source
Expand description

ryuk: a Laravel-style full-stack framework on axum.

Every module is a Cargo feature (all on by default via full):

featureadds
sessionssession layer
inertiaInertia protocol, Vite assets, flash/errors
authargon2 passwords, Auth extractors
validationForm<T> extractor
openapiutoipa docs at /docs and /openapi.json
dbSeaORM connect + migrations
queuedatabase-backed jobs (needs db)
apiweb/api route groups, ApiAuth, JSON errors, CORS
apikeysAPI keys for machine clients
oauth-serverOAuth2 authorization server
socialsocial login (GitHub, Google)
passkeyWebAuthn/FIDO2 passkeys (needs auth, db, sessions)
pushdevice registry, FCM + APNs push notifications
maillog / SMTP mailer
s3 mcpS3-compatible disk, Model Context Protocol server
storage http cache events scheduledisks, HTTP client, cache, events, scheduler
gate crypt notifications langpolicies, encryption + signed URLs, notifications, localization
csrfCSRF middleware (Inertia/axios compatible)
safetylogin throttle, one-time tokens (needs db)
sqlite postgres mysqldatabase drivers (URL scheme picks one)
session-db session-file session-moka session-redissession stores

Modules§

api
The machine-facing route groups: Principal, ApiAuth, JSON ApiErrors, Cors and the rate limiter. App::api / App::public wrap their routes with these (and never with sessions or CSRF).
apikey
Machine-to-machine API keys (table api_keys, self-created, SQLite/PostgreSQL/MySQL).
app
Application builder and env-driven Config.
auth
Sessions, password hashing and the Auth extractors.
cache
Application cache with a Laravel-style API: JSON values (serde), per-key TTL, atomic add and increment.
crypt
Authenticated encryption and signed URLs, shaped like Laravel’s Crypt and URL::signedRoute. Both are keyed from APP_KEY (base64: + 32 bytes, the same format as Laravel; make one with Crypt::generate_key).
csrf
CSRF protection, compatible with axios / Inertia (they echo the XSRF-TOKEN cookie as X-XSRF-TOKEN).
db
SeaORM connection and migrations.
events
Event dispatcher, shaped like Laravel’s events: listeners are keyed by event type and run in registration order.
gate
Authorization gates and policies, shaped like Laravel’s Gate.
health
/healthz (liveness) and /readyz (readiness) endpoints.
http
Outbound HTTP client, shaped like Laravel’s Http facade, over reqwest.
inertia
Inertia.js protocol for axum: JSON on X-Inertia requests, HTML shell otherwise.
lang
Localization (feature lang): translation files, :name placeholders, simple pluralization and Accept-Language negotiation. No extra dependencies.
mail
Mail: Mail builder + Mailer with log (default) and smtp drivers.
mcp
Model Context Protocol server (Laravel laravel/mcp shaped): tools, resources and prompts served over Streamable HTTP (request/response JSON) or newline-delimited stdio.
notifications
Laravel-style notifications: one message, delivered over several channels (feature notifications = mail + db).
oauth_server
OAuth2 authorization server (RFC 6749 + PKCE 7636 + revocation 7009 + introspection 7662).
openapi
OpenAPI spec at /openapi.json and Scalar UI at /docs.
passkey
Passkey (WebAuthn/FIDO2) registration and discoverable sign-in (table passkeys, self-created, SQLite/PostgreSQL/MySQL). Wraps Kanidm’s webauthn-rs: no hand-rolled CBOR/COSE/attestation parsing. Feature passkey needs auth, db, sessions.
prelude
use ryuk::prelude::*; everything an app handler needs from the enabled features.
proxy
Trusted proxies and the ClientIp extractor.
push
Push notifications: device registry (push_devices, self-created), a Notification builder and a Push service with FCM HTTP v1 (Android) and APNs HTTP/2 (iOS) providers.
queue
DB-backed background jobs (tables jobs / failed_jobs, self-created).
s3
S3-compatible storage disk: AWS S3, MinIO, Cloudflare R2, Backblaze B2, DigitalOcean Spaces, Wasabi, Garage, RustFS. AWS Signature V4 is implemented here over reqwest (no AWS SDK).
schedule
Task scheduler, shaped like Laravel’s: declare tasks in code, tick once a minute.
security
Default hardening layers: security headers, body limit, timeout, panic catching, request ids.
session
Cookie sessions (tower-sessions 0.14). Inertia flash/errors and auth both sit on this.
social
Social login: an OAuth2 client for GitHub and Google (authorization code + PKCE S256 + state).
storage
Named filesystem disks, shaped like Laravel’s Storage facade.
tenancy
Multi-tenancy: organizations, memberships with roles, and email invitations (tables orgs, org_members, org_invites, self-created, SQLite/PostgreSQL/MySQL). Feature tenancy (the Member extractor also needs auth).
throttle
DB-backed login throttling (table login_attempts, self-created, SQLite/PostgreSQL/MySQL).
tokens
DB-backed single-use tokens for email verification and password reset (table one_time_tokens, self-created, SQLite/PostgreSQL/MySQL).
validation
Validated request bodies. Form<T> accepts urlencoded or JSON and runs validator.