Menu

1 / 5

Instant GraphQL and REST from Any Postgres Database: Introducing graphpg

DEV Community: rust·Mihai Farcas·about 15 hours ago
#byog968b
#devtorust#devto#dev#graphql#graphpg
Reading 0:00
15s threshold

Originally published on mihai.ltd .

If you avoided GraphQL because of resolver boilerplate, or found tools like Hasura too heavy, here is what a database-first Rust engine looks like.

Many developers like the idea of GraphQL: instead of writing dozens of custom endpoints ( /users , /users/:id/posts , /posts/:id/comments ), your frontend requests the exact data shape it needs in a single request.

In practice, building a GraphQL API from scratch often stops people from adopting it. You write your SQL tables. Then you write a GraphQL schema that mirrors those tables. Then you write resolver functions for every field, write batch loaders to avoid N+1 query loops, and write custom validation. Before long, you are maintaining two copies of your data model and writing more boilerplate than you would have with plain REST.

Tools like Hasura and PostGraphile proved there is a better way: let the database define the API.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.