Image 1 of 1


Product information

Grafbase provides a modern developer experience to build and deploy high performance GraphQL APIs.

Integration type

In this guide, we will focus on adding Vendure as a Grafbase data source and enabling GraphQL Edge Caching to improve commerce experiences as well as:

  1. Speed — Get globally fast response times and reduce server load with Edge Caching.
  2. Flexibility — Combine data from multiple APIs effortlessly using Connectors.
  3. Savings — Stay within your API limits and save money.
  4. Insights — Monitor your API in real-time with Grafbase Analytics.

Get started locally

Begin by executing the following command inside a new or existing project’s directory:

npx grafbase@latest init --template graphql-vendure

Next, open the file grafbase.config.ts and make any adjustments.

By default, Grafbase will:

  • Add Vendure as a data source
  • Cache all queries for 60 seconds
  • Enable public access to your GraphQL API
import { config, connector, graph } from '@grafbase/sdk'

const g = graph.Standalone()

const vendureUrl =
  process.env.VENDURE_GRAPHQL_API_URL || ''

const vendure = connector.GraphQL('Vendure', {
  url: vendureUrl,

g.datasource(vendure, { namespace: false })

export default config({
  graph: g,
  auth: {
    rules: rules => {
  cache: {
    rules: [
        types: ['Query'],
        maxAge: 60,
        staleWhileRevalidate: 60,

If you plan to add other data sources, you should enable namespaces to prevent schema conflicts.

The configuration above uses the environment variable VENDURE_GRAPHQL_API_URL. Make sure to create the file .env with the correct value:


Finally, start the Grafbase development server by running the command below:

npx grafbase@latest dev

You now have a GraphQL API running locally that sits in front of your Vendure API! 🎉

You can execute any GraphQL query or mutation you normally would with Vendure using your local endpoint:

Grafbase Pathfinder can be accessed at where you can explore the API and schema.

Deploy to production

Follow these steps to deploy your GraphQL API to production using the Grafbase CLI:

  • Sign up for a Grafbase account
  • Create a new project
  • Connect and deploy your application where the grafbase was added
  • Make sure to add your VENDURE_GRAPHQL_API_URL environment variables when deploying
  • Update your host (Netlify, Vercel,, etc.) with the new GraphQL API endpoint that Grafbase supplied for your new project.

That’s it! Your customers will now experience faster load times which translates to higher conversions.

Grafbase automatically deploys a new version of your API each time it identifies a change to grafbase.config.ts. Consequently, if you need to adjust any cache settings, including parameters like maxAge, staleWhileRevalidate, and mutationInvalidation, you’re free to do so.

Get started

Create your first commerce experience with Vendure in less than 2 minutes

Vendure is a registered trademark. Our trademark policy ensures that our brand and products are protected. Feel free to reach out if you have any questions about our trademarks.


Get the latest product news and announcements delivered directly to your inbox.

© Copyright 2022 - 2024, Vendure GmbH. All rights reserved.