CLI Commands

The commands below can be used with the Grafbase CLI.

You use the init command to initialize a new project, or existing project.

npx grafbase init hello-world

If you already have a project, change directory and run:

cd my-project
npx grafbase init

The init command will create the new directory grafbase that contains your schema, environment variables, and more.

You use the dev command to start the local Grafbase server.

npx grafbase dev

You can then visit the following URLs to access:

You can override the default behaviour of dev by passing various flags.

  • --port PORT — Set a different port the server runs on. Defaults to 4000.
  • --disable-watch — Disable restarting the server when a change to your schema is detected.

You can use the reset command to reset your project data:

npx grafbase reset

This does the same as deleting the .grafbase directory.

You can use the help command to list the available commands and options, as well as the installed version details.

npx grafbase help
Was this page helpful?