Annoucing Wundergraph - A compile time ORM to implement GraphQL APIs

I'm happy to finally announce Wundergraph officially. Wundergraph is a crate that aims to simplify the development of GraphQL based APIs using Diesel and Juniper greatly, while using Diesel internally to provide a type safe SQL interface. Wundergraph helps to prevent common N + 1 query problems with complex GraphQL requests by executing only a bounded number of optimized queries. The example below contains a small toy schema that is created with Wundergraph and is usable as part of your Juniper schema.

#[macro_use] extern crate diesel;
use wundergraph::prelude::*;

table! {
    heros {
        id -> Integer,
        name -> Text,
        hair_color -> Nullable<Text>,
        species -> Integer,
    }
}

table! {
    species {
        id -> Integer,
        name -> Text,
    }
}

#[derive(Clone, Debug, Identifiable, WundergraphEntity)]
#[table_name = "heros"]
pub struct Hero {
    id: i32,
    name: String,
    hair_color: Option<String>,
    species: HasOne<i32, Species>,
}

#[derive(Clone, Debug, Identifiable, WundergraphEntity)]
#[table_name = "species"]
pub struct Species {
    id: i32,
    name: String,
    heros: HasMany<Hero, heros::species>,
}

wundergraph::query_object!{
    Query {
       Hero,
       Species,
   }
}

Links:
* Documentation
* Repository
* Slides from RustFest workshop covering wundergraph

I am looking forward for feedback and collaboration.

5 Likes