Skip to main content


Typegate version

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.

With Docker

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.

- "7890:7890"
- "host.docker.internal:host-gateway"
# only for dev, generate secure values for production
TG_SECRET: "a4lNi0PbEItlFZbus1oeH/+wyIxi9uH6TpL8AIqIaMBNvp7SESmuUBbfUwC0prxhGhZqHw8vMDYZAGMhSZ4fLw=="
REDIS_URL: redis://:password@redis:6379/0
DEBUG: "true"
- redis

image: redis:7
restart: always
command: --requirepass password
# launch the containers
docker compose up --detach

# watch the typegate logs
docker compose logs typegate --follow

Internal APIs

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.

  • /typegate
  • /prisma-migration

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.

Request lifecycle

When a new request fires a trigger, the typegate orchestrates the following stages:

  1. extract the secure request context from custom authentication or JSON Web Token (JWT)
  2. 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
  3. 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
  4. manage metadata of the request

HTTP/GraphQL interface

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:

  1. Efficient querying: the client can specify exactly what data it needs, reducing the amount of over- or under-fetching
  2. Flexibility: allows for retrieving multiple resources in a single request, unlike REST, which often requires multiple ones
  3. Typing: GraphQL has a built-in type system that allows for better documentation and stronger validation of the requests
  4. Improved tooling: tools and libraries around GraphQL are rapidly growing and great a development experience