GraphQL / Installation & setup
CLI tools & setup
Prepare your workspace, run a small example and check the result before starting the course.
A terminal is where you type commands. A runtime or compiler runs your code; a package manager installs project dependencies. Follow the tools and command surfaces named in this course’s guide.
Already set up? Continue to What is GraphQL →
BEFORE THE FIRST CODING TASK
Your computer, ready to learn.
A local GraphQL execution fixture
Create a new practice folder in your editor and open its integrated terminal there. Use a separate folder from personal or production projects. Install supported Node LTS and use a new practice directory. This first fixture executes GraphQL locally without an HTTP server. Transport and authentication are separate later topics.
Already configured? Run the verification steps and continue. Use the command surface labelled beside each snippet, such as your terminal or SQL console.
Files to create
Save these files in the practice folder described above before running its file commands.
import { buildSchema, graphql } from "graphql";
const schema = buildSchema("type Query { hello: String! }");
const result = await graphql({
schema,
source: "{ hello }",
rootValue: { hello: () => "My workspace is ready" }
});
console.log(JSON.stringify(result));
- 1
Initialize this new package and install the GraphQL implementation.
Windows · Terminalnode --version npm init -y npm install graphqlWhat you should see: The package and lockfile are created. Record the resolved GraphQL version.
Something didn’t work?
Check the actual package-install output and Node compatibility.
- 2
Save query.mjs below and execute it.
Windows · Terminalnode query.mjsWhat you should see: The result has data.hello equal to My workspace is ready and no errors.
Something didn’t work?
Check schema syntax, field names and module loading. A GraphQL error differs from failing to start Node.
Check it yourself
Change the requested field to an unknown field and inspect validation errors, then restore the valid query. This verifies local query execution only.
This is a self-check; it does not mark a lesson or course complete.
Official setup guides & version requirements
My workspace notes
Notes stay in this browser. They are not uploaded or assessed.