# Using ./router without a supergraph schema... or how to generate a supergraph schema

**URL:** <https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772>\
**Category:** Router\
**Created:** [March 21, 2025, 8:24pm UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772 "2025-03-21T20:24:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Kor](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/john_kor/32/5917_2.png) [@John\_Kor](https://community.apollographql.com/u/John_Kor)\
**Post date:** [March 21, 2025, 8:24pm UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/1 "2025-03-21T20:24:01Z")

</div>

hi everyone, we currently have a federation gateway implemented just using `@apollo/gateway` and we specify the subgraphs with something like this in the options:

```auto
subgraphs: [{ name: service.name, url: service.url, }, {..}, ...],

```

im now looking at using the `./router` command instead, but im hitting a wall, mainly around how i specify the subgraphs. it seems like i need to pass in a **supergraph schema** in order to start the router, instead of specifying the name/urls of each subgraph. i have a couple of questions:

1. its unclear in the documentation how to generate this supergraph schema. how do i do this?
2. id much rather start the `./router` command with just a list of the subgraphs and urls, similar to how its done in the `@apollo/gateway` package. is this possible with `./router` ?

---

<div class="post-metadata">

**Author:** ![Michelle\_Mabuyo](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/michelle_mabuyo/32/80_2.png) [@Michelle\_Mabuyo](https://community.apollographql.com/u/Michelle_Mabuyo)\
**Post date:** [March 21, 2025, 8:42pm UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/2 "2025-03-21T20:42:19Z")

</div>

Hey @John_Kor ! Great questions.

> 1. its unclear in the documentation how to generate this supergraph schema. how do i do this?

You can use `rover supergraph compose`, passing in a `supergraph.yaml` file that lists all your subgraph schemas and URLs.

`supergraph.yaml`:

```auto
federation_version: =2.10.0
subgraphs:
  products:
    routing_url: http://localhost:4000
    schema:
      file: ./products.graphql # Schema provided via file
  reviews:
    schema:
      subgraph_url: http://localhost:4001 # Schema provided via introspection, routing_url can be omitted
  users:
    # routing_url: <Optional, pulled from GraphOS registry by default>
    schema: # Schema downloaded from GraphOS registry, does not poll for updates
      graphref: mygraph@current
      subgraph: actors

```

> **[Rover supergraph Commands](https://www.apollographql.com/docs/rover/commands/supergraphs#supergraph-compose)**
>
> Learn Rover CLI commands for fetching, composing, and managing supergraphs within federated GraphQL architectures.

If you’re using GraphOS and publishing your subgraph schemas to Studio, then you can also directly use your graph credentials (`APOLLO_KEY` and `APOLLO_GRAPH_REF`) with the `./router` command and it will take care of fetching the supergraph schema for you so you don’t have to use `rover supergraph compose`. [Here’s the relevant docs page](https://www.apollographql.com/docs/graphos/routing/configure-your-router#configuring-a-self-hosted-router).

The command would look like this:

```auto
APOLLO_KEY="..." APOLLO_GRAPH_REF="..." ./router

```

> 1. id much rather start the `./router` command with just a list of the subgraphs and urls, similar to how its done in the `@apollo/gateway` package. is this possible with `./router` ?

For local development, I recommend using `rover dev`, which spins up a local graph for you. [Here’s the relevant docs page](https://www.apollographql.com/docs/rover/commands/dev#starting-a-session-with-multiple-subgraphs).

The command would look like this:

```auto
rover dev --supergraph-config supergraph.yaml

```

Hope that helps, let me know if you have any follow-up questions!

---

<div class="post-metadata">

**Author:** ![John\_Kor](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/john_kor/32/5917_2.png) [@John\_Kor](https://community.apollographql.com/u/John_Kor)\
**Post date:** [March 21, 2025, 9:01pm UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/3 "2025-03-21T21:01:08Z")

</div>

thanks so much for the quick response @Michelle_Mabuyo !

regarding point #1, understood!

regarding point #2, it sounds like theres a local development solution using `rover dev`. however, what about in production? what i like about the current implementation we have with `@apollo/gateway` is that we can just specify urls at start time as well as a polling interval so that the gateway is always up to date (ie. we can make changes to subgraphs in isolation without needing to restart our gateway)

with the current implementation of `./router` in production (to the best of my knowledge), it seems as though whenever we make a change to a subgraph we will also need to regenerate a supergraph.schema while also restarting the gateway. am i understanding this correctly or is there better way to handle this? we do not use graphOS at the moment

---

<div class="post-metadata">

**Author:** ![dncrews](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dncrews/32/5589_2.png) [@dncrews](https://community.apollographql.com/u/dncrews)\
**Post date:** [March 22, 2025, 12:30am UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/4 "2025-03-22T00:30:02Z")

</div>

Hey @John_Kor. I’m not sure you want the advice, so feel free to ignore it. Also, we _do_ use graphOS, so I could be wrong about some of this.

First, both `serviceList` and its replacement, `IntrospectAndCompose` are recommended _against_ use in production, due to their instability. If, for example, one service just happens to have downtime during a scale up, scale down, or restart event in your router, your entire API could go down.

As far as “new supergraph.schema while also restarting the gateway”, there is a `--hot-reload` flag, [documented here](https://www.apollographql.com/docs/graphos/reference/router/configuration#--hr----hot-reload) that will watch the the supergraph file passed during startup. If you enable that flag, all you would have to do is replace that file, and it would update your schema.

---

<div class="post-metadata">

**Author:** ![John\_Kor](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/john_kor/32/5917_2.png) [@John\_Kor](https://community.apollographql.com/u/John_Kor)\
**Post date:** [March 24, 2025, 8:25pm UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/5 "2025-03-24T20:25:11Z")

</div>

Hey @dncrews thanks for the response! This is super helpful to know, as I didn’t know this before 🙂 I’ll work towards revising our setup asap so it uses a static super graph schema going forward. I don’t think I ever noticed this caveat in the docs for setting up Apollo/gateway initially so this is super helpful

We are looking for a solution that ideally does not require a subscription fee to graphos. Is there anything “free” available that would host an updated super graph schema? I personally find the Apollo docs and services available a bit hard to follow so any advice here would be appreciated. Cheers!

---

<div class="post-metadata">

**Author:** ![dncrews](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dncrews/32/5589_2.png) [@dncrews](https://community.apollographql.com/u/dncrews)\
**Post date:** [March 25, 2025, 5:11am UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/6 "2025-03-25T05:11:44Z")

</div>

As for a solution, it depends on what you mean by “free” and what your needs are, but there are options.

The Guild released a collection of open source solutions that form a platform called Hive, which has a [self-hosted option](https://the-guild.dev/graphql/hive/docs/self-hosting/get-started). I’ve never looked too deeply, so I don’t know the full compatibility or feature set compared either to their own paid solution or Apollo, and from the docs it looks like there’s a lot of infrastructure that might be needed.

If I were paying the bill from my own pocket, on a budget looking for a “much much more free, please” option, I’d probably just push the subgraph schemas to S3 during the deployment process. Then I’d build a lambda that is triggered from a file drop, which takes all of the schemas, composes a supergraph, and updates the file hosted alongside the router. There’s no frills here, but if your team is small enough that you don’t need the controls and change management of a platform, and all you need is a stable registry, there’s not much that is less expensive or more stable than a file in S3.

---

<div class="post-metadata">

**Author:** ![Michelle\_Mabuyo](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/michelle_mabuyo/32/80_2.png) [@Michelle\_Mabuyo](https://community.apollographql.com/u/Michelle_Mabuyo)\
**Post date:** [March 28, 2025, 4:50pm UTC](https://community.apollographql.com/t/using-router-without-a-supergraph-schema-or-how-to-generate-a-supergraph-schema/8772/7 "2025-03-28T16:50:25Z")

</div>

@John_Kor, have you checked out [the Apollo Free tier](https://www.apollographql.com/pricing)? With the free tier, you can publish your subgraph schemas to GraphOS and it composes the supergraph schema for you. Your router can then connect to the most up-to-date schema without needing to hot-reload.

And if there’s anything specific you’d like to share about what you’re having trouble with finding in the docs, please let me know! I work on the Education team at Apollo and definitely open to feedback for improving our content 🙂
