Skip to content

Rust graphql complex api using diesel, juniper, juniper-from-schema, juniper-eager-loading and actix

Notifications You must be signed in to change notification settings

Farkal/rust-graphql-complex-api-example

Repository files navigation

This repo is a work in progress example of making complex api with diesel, juniper, actix, juniper-from-schema and juniper-eager-loading (needed to solve N+1 issues and this lib work with juniper-from-schema).
The goal is also to find where we can ease some process between diesel and juniper (matching types...).
I am pretty new to rust so I encourage everybody to check this code and sugest improvements !

Init

Just run diesel database setup --database-url postgres://postgres:postgres@localhost/graphqlapi

Run

docker-compose up -d
cargo run

Schemes

Database

Database scheme

Observations

  • When using enum we need to implement lot of code to be able to store it into diesel (create new enum, impl From for the diesel enum and for the graphql enum) -> see this file

TODO

  • Add tests
  • Add metrics route (prometheus for exemple)
  • Add health route (for kube check health)
  • Create public and private api with differents ports but sharing database, metrics...
  • Add Dockerfile

About

Rust graphql complex api using diesel, juniper, juniper-from-schema, juniper-eager-loading and actix

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published