Database

Grafbase provides a flexible and scalable database that you build using schema, and manage using a intuitive UI.

The database is low latency, serverless, multi-region and deploys instantly with zero downtime.

Grafbase automatically generates queries to fetch by ID, unique value, or a collection as well as all the necessary mutations to create, update, delete, link, and unlink data.

The file grafbase/schema.graphql is at the core of your project's database.

The schema file describes the shape of your data, relations, and configuration for validations and auth using the GraphQL schema definition language.

GraphQL SDL

This database can be used by itself or together with other Grafbase features.

Grafbase automatically builds a CRUD API for GraphQL types tagged with @model inside the file grafbase/schema.graphql.

You can create a model using the directive @model with any of your GraphQL types. Each model will have its own set of GraphQL queries and mutations.

type Post @model {
  slug: String! @unique
  title: String!
  published: Boolean @default(value: false)
  rating: Float
  likes: Int
}

You can also create regular object types that can be embedded inside of your existing models:

type Order @model {
  billingAddress: Address
  shippingAddress: Address
}

type Address {
  line1: String!
  line2: String
  zip: String
  phone: PhoneNumber
}

Grafbase automatically manages system fields for any @model type.

Models contain fields that you set. You can think of these as columns in a database table, and work with any supported scalar.

Grafbase does not currently support Interface or Union types.

Was this page helpful?