Skip to main content
Version: v3.x (DDN)

Deploy your Supergraph

What's about to happen?

You're about to deploy your supergraph to Hasura DDN, our globally-distributed, highly-available, lightning-fast hosted service!

Deploy your supergraph to Hasura DDN

Steps

Required

Step 1. Build and deploy your supergraph

Run:
ddn supergraph build create
Project set in context

Remember that because we set the project context, we don't need to pass the project name as a flag in the command.

Step 2. Explore your supergraph in the Hasura Console

The CLI will respond with a build version and build Console URL. Click on it!

You can go ahead and explore the API for this build in the Hasura Console!

Step 3. Apply your supergraph as your project's endpoint.

An applied build is the default one that is served by your Hasura DDN project endpoint.

To apply a build, run:
ddn supergraph build apply <supergraph-build-version>
Your API is still private

By default, all Hasura DDN projects are in Private API Access Mode and accessible only to project collaborators. In your console on DDN you will see a JWT token set in the x-hasura-ddn-token header which you can use to access your API from both the console and any client app. This token will expire after 1 hour and you can regenerate it by refreshing the console.

You can navigate to the project's settings and switch the API Access Mode setting to Public to make your API accessible to anyone.

Note: Your API will be now be accessible from any source and you should protect it using either the JWT or webhook auth configuration.

What did this do?

When you ran the command above, the CLI used the configuration you provided to create an immutable build of your supergraph on Hasura DDN. This build is now accessible via the build's GraphQL endpoint and in the Hasura Console for exploration.

Teammates can explore the API, interact with it, and provide feedback before you iterate and create a new build for testing. Or, if you're ready, you can apply the build so that it's served by the project's endpoint. And, should you realize you applied it a little early, you can easily roll it back by applying an older build.

Next steps

At this point, you have all the ingredients and knowledge to create a robust supergraph that composes data across various sources and aggregates them into a single, reliable, performant API. Before moving to production, consider the resources below:

Migrations

Hasura recommends a number of third-party solutions for managing database migrations. Commonly, users implement migrations via CI/CD with Flyway or similar resources.

Doesn't Hasura manage migrations?

In v2, Hasura provided a built-in migration tool. However, as v3 metadata is decoupled from the underlying data source, you are free to manage your migrations however you wish.

Performance optimizations

Hasura provides a suite of observability tools directly in a project's DDN console. You can view traces, query plans, and general usage statistics. These are helpful for diagnosing common bottlenecks and problems with your application's performance. You can read more about these here.

CI/CD

You can create a pipeline for deployments using any tools you wish. As we recommend initializing a git repository early in the project creation process, and provide operability with environment variables, you can follow any git-workflow best practices for moving between development, staging, and production environments. Additionally, we provide a configurable GitHub Action for automatically managing your deployments.