Before you start: pick how you’ll run the course
The course environment is a dev container. You can run it in a GitHub Codespace (in your browser, nothing to install) or locally on your own machine. Either works, but read this first.
A Codespace stops itself after 30 minutes without activity. Reading a lesson counts as inactivity, so during a session it’s easy to come back from a few pages of reading and find the server gone and Apollo Sandbox unable to load the schema. If Sandbox suddenly can’t autocomplete or shows no documentation, this is almost always why.
✏️ Pick one of these before you begin:
- Raise the idle timeout. Go to github.com/settings/codespaces and set Default idle timeout to a longer period, such as 90 or 240 minutes. Do this before creating the Codespace, since the setting applies when the Codespace starts. Longer timeouts use more of your included hours.
- Run it locally instead. Clone bitovi/graphql-and-kafka-workshop, open it in VS Code with the Dev Containers extension, and run Dev Containers: Reopen in Container, choosing the GraphQL 101 configuration. Nothing times out, and it doesn’t count against your Codespaces hours. You’ll need Docker running.
If a Codespace does stop on you, no work is lost. Start it again from github.com/codespaces and re-run the npm run dev command below.
Create the Codespace
The course environment runs in a GitHub Codespace, a cloud development environment that opens in your browser with everything preinstalled.
✏️ Click the button below to create a Codespace:
✏️ Confirm these options, then click Create codespace:
| Option | Value |
|---|---|
| Repository | bitovi/graphql-and-kafka-workshop |
| Branch | main |
| Dev container configuration | GraphQL 101 |
| Region | East US or West US |
| Machine type | 2-core |
✏️ Once the Codespace finishes loading, start the API by running this in its terminal:
cd services/policies && npm run dev
You should see:
🚀 Policies service ready at http://0.0.0.0:4001/
Codespaces opens port 4001 in a new browser tab, showing Apollo Sandbox, an in-browser editor for writing and running GraphQL queries. If the tab doesn’t open, open the Ports tab in the Codespace and click the globe icon next to port 4001.
Leave the server running while you work through the course. It restarts on its own when you save a change.
When you take a break
GitHub charges Codespaces use by the hour while a Codespace is running, and personal accounts get a free amount each month. A Codespace stops on its own after 30 minutes without activity, unless you’ve changed that setting. To stop it sooner, see Stopping and starting a codespace. Your changes are kept, and you can start it again from the same page.
A stopped Codespace still counts toward your Codespaces storage, which GitHub also bills. When you finish the course, delete the Codespace from github.com/codespaces.
Next steps
Next, we’ll learn what GraphQL is, and run our first query.