GraphQL Warp Server Template

Hi guys,

I have been playing around with Rust lately in order to learn the language before beginning a new project for my thesis. I thought it would be useful to create a GraphQL server template for future projects and I want to share it with you here, so you can tell me if there is something in it that is not really rusty, and, also, so you can use it if you need it.

You can find the source code at: https://gitlab.com/Kozaky/graphql_template

The project uses:

  • Warp, as the server
  • Juniper, to implement GraphQL
  • tokio-postgres, which will allow us to query a PostgreSQL database
  • Refinery, to make database migrations

And it is composed of the following modules:

  • domain, where the entities needed are defined ( these entities can be database entities or entities consumed from any other source)
  • db defines queries and the database access
  • web, which will configure a warp server for us along with some GraphQL services.
  • application, where the general configuration is provided and the warp server is started.

I think it is also worth mentioning that the project uses Docker and Gitlab CI.

P.S. 1 The project is currently missing tests, but I plan to implement them at some point divided by module.

P.S. 2 I am also planning to deploy this project on a Raspberry PI cluster using Docker Swarm, does anybody know if I could face any problem with the current configuration? Is there anything I should take into account, regarding code?

Thank you all.

Regards,

Kozaky

2 Likes