[go: up one dir, main page]

Skip to content
forked from specta-rs/rspc

A framework for building typesafe web backends in Rust

License

Notifications You must be signed in to change notification settings

aptos-labs/rspc

 
 

Repository files navigation

Logo

rspc

🚧 Work In Progress 🚧

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

Website


Warning

This branch contains some major changes for the 0.3.0 release.

For 0.2.x checkout v0.x

For v1.0.0-rc.x (deprecated for now) checkout mainmain


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!

About

A framework for building typesafe web backends in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 68.1%
  • TypeScript 29.7%
  • Svelte 1.1%
  • Other 1.1%