rspc

Crates.iorspc
lib.rsrspc
version
sourcesrc
created_at2022-07-03 13:35:58.492029
updated_at2024-12-03 15:11:40.594288
descriptionA blazing fast and easy to use TRPC server for Rust.
homepage
repositoryhttps://github.com/specta-rs/rspc
max_upload_size
id618342
Cargo.toml error:TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Oscar Beaumont (oscartbeaumont)

documentation

https://docs.rs/rspc/latest/rspc

README

Logo

rspc

A blazing fast and easy to use TRPC-like server for Rust.

Website


Discord crates.io download count badge docs.rs npm (scoped)

Example

You define a rspc router and attach procedures to it like below. This will be very familiar if you have used trpc or GraphQL before.

let router = <rspc::Router>::new()
    .query("version", |t| {
        t(|ctx, input: ()| "0.0.1")
    })
    .mutation("helloWorld", |t| {
        t(|ctx, input: ()| async { "Hello World!" })
    });

Features:

  • Per Request Context - Great for database connection & authentication data
  • Middleware - With support for context switching
  • Merging routers - Great for separating code between files

Inspiration

This project is based off trpc and was inspired by the bridge system Jamie Pine designed for Spacedrive. A huge thanks to everyone who helped inspire this project!

Commit count: 510

cargo fmt