There are several things to consider when setting up a GraphQL endpoint; choosing a suitable database, handling the n+1 problem, using a cache, security rules.
GraphQL has moved the many requests problem from the HTTP layer to the database layer. Instead of many REST calls, we only need to execute one GraphQL request.
However, one GraphQL request often results in many database calls, which basically moves the performance problem to the database layer.
FaunaDB is a distributed database that comes out-of-the-box with GraphQL and a flexible security layer. Import your schema, let FaunaDB generate the collections and indexes to support your schema, and you can benefit from a scalable, distributed GraphQL endpoint in 30 seconds. Due to the composable nature and graph-like querying features of the Fauna Query Language (FQL), FaunaDB can offer a GraphQL endpoint that compiles GraphQL queries to FQL 1:1.
No more n+1 problem, no need of a cache, and since each GraphQL query translates to one query, you can also take advantage of FaunaDB's strong consistency and flexible security model.
Enjoying these posts? Subscribe for moreJoin
Already have an account? Sign in