📄️ Leto - GraphQL Server
A complete implementation of the official
📄️ Quickstart
This provides a simple introduction to Leto, you can explore more in the following sections of this README or by looking at the tests, documentation and examples for each package. A fullstack Dart example with Flutter client and Leto/Shelf server can be found in https://github.com/juancastillo0/leto/tree/main/chat_example
📄️ Examples
Beside the tests from each package, you can find some usage example in the following directories and external repositories:
📄️ Packages
This repository is a monorepo with the following packages
📄️ Web integrations
Although you can use packageleto to execute GraphQL requests in any Dart application, GraphQL servers are usually deployed to the web. We provide a couple of utilities and integrations for creating and using GraphQL web servers powered by Leto.
📄️ Documentation
The following sections introduce most of the concepts and small examples of building GraphQL executable schemas and servers with Leto. Please, if there is something that may be missing from the documentation or you have any question you can make an issue, that would help us a lot.
📄️ Resolvers
GraphQL resolvers execute the logic for each field and return the expected value typed according to the schema. In Dart this are functions that receive the parent's object value and the field's Ctx, and return the execution result. Simple fields may only return a property of the parent object value. However, there may also be complex resolvers, such as mutations, that validate the input data and create rows in a database, or queries that retrieve multiple rows according to complex authorization logic.
📄️ Validation
Schema Validation
📄️ Miscellaneous
GraphQLResult
📄️ Solving the N+1 problem
When fetching nested fields, a specific resolvers could be executed multiple times for each request since the parent object will execute it for all its children. This may pose a problem when the resolver has to do non-trivial work for each execution. For example, retrieving a row from a database. To solve this problem, Leto provides you with two tools: LookAhead and DataLoader.
📄️ Extensions
Extensions implement additional functionalities to the server's parsing, validation and execution. For example, extensions for tracing (GraphQLTracingExtension), logging (GraphQLLoggingExtension), error handling or caching (GraphQLPersistedQueries and GraphQLCacheExtension). All extension implementations can be found in the extensions folder in package:leto. The main API with all the methods that can be overridden is found in this file.
📄️ Directives
For more information: GraphQL specification
📄️ Attachments
This API is experimental.
📄️ Utilities
Most GraphQL utilities can be found in the utilities folder in package:letoschema.
📄️ Contributing
Thanks for considering making a contribution! Every issue or question helps!