With Metatype Cloud
This is the easiest way to get started, yet it's not publicly accessible. You can sign up for the private beta below.
Install Docker and use the following
compose.yml to launch a typegate node. Redis is the single required dependency, however in practice you will want to add database or other systems that the typegate can connect to.
# only for dev, generate secure values for production
command: --requirepass password
# launch the containers
docker compose up --detach
# watch the typegate logs
docker compose logs typegate --follow
Most of the internal APIs are still unstable, and may change without notice. If you still want to experiment with them, you can use the GraphQL introspection to discover them.
The typegate nodes - or typegates - are the central components of the ecosystems. They build and type check typegraphs, and expose them through a HTTP/GraphQL interface. They enforce the type safety of the data flows, connect to all the runtimes and orchestrate the execution of incoming requests.
When a new request fires a trigger, the typegate orchestrates the following stages:
- extract the secure request context from custom authentication or JSON Web Token (JWT)
- retrieve cached execution plan or compute a new one
- traverse the typegraph to create a DAG of the required types
- optimize the DAG to reduce the number of calls to the runtimes
- pre-compute all structural elements and data resolutions
- execute the plan
- type check the arguments
- verify lazily policies on the need
- run the DAG execution
- enforce the rate-limiting
- type check the response
- manage metadata of the request
For now, the typegate nodes are only accessible through HTTP/1.1 and HTTP/2. More protocols could be supported in the future. Typegates expose a GraphQL interface which is the result of a typegraph projected onto corresponding GraphQL types. While this reduces the type safety of the data flowing, it makes more interoperable thanks to the many high-quality and well-known GraphQL tooling already available. The underlying types are also exposed in order for API clients to verify the underlying types.
GraphQL, being a query language, offers a great asset for Metatype's philosophy:
- Efficient querying: the client can specify exactly what data it needs, reducing the amount of over- or under-fetching
- Flexibility: allows for retrieving multiple resources in a single request, unlike REST, which often requires multiple ones
- Typing: GraphQL has a built-in type system that allows for better documentation and stronger validation of the requests
- Improved tooling: tools and libraries around GraphQL are rapidly growing and great a development experience