Grafbase CLI now available

Grafbase CLI now available

We're extremely happy to announce the release of the Grafbase CLI.

The CLI allows you to create and develop your projects locally, in the comfort of your own ~. No configuration, or Docker needed.

In a new directory, run the following to get started:

npm i -g grafbase
grafbase init

Then populate grafbase/schema.graphql with the following:

type TodoList @model {
  id: ID!
  title: String!
  todos: [Todo]
}

type Todo @model {
  id: ID!
  title: String!
  complete: Boolean
}

Run the following to start your local development environment:

grafbase dev

Now with Grafbase running locally you will be able to execute the GraphQL operations generated from the schema defined above.

You can now visit the GraphQL Playground at http://localhost:4000 to create a new Todo List entry, with related Todos:

mutation {
  todoListCreate(
    input: {
      title: "My todo list"
      todos: [
        { create: { title: "My first todo!" } }
        { create: { title: "My second todo!" } }
      ]
    }
  ) {
    todoList {
      title
      todos {
        title
      }
    }
  }
}

You can also update, delete, query all or individual entries for the models you defined above. Here's an example querying for the first 100 todoList items, and their linked todos:

{
  todoListCollection(first: 100) {
    edges {
      node {
        title
        todos {
          title
        }
      }
    }
  }
}

You can learn more about the CLI here. The CLI is open source, and built with Rust.

We'd love to hear your feedback and ideas, so join us on Discord.