@grafbase/nextjs-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@grafbase/nextjs-plugin

A Next.js "plugin" that automatically starts the Grafbase CLI.

Usage

It's easy as 123!

Step 1

Install grafbase as a devDependency:

npm install -D grafbase @grafbase/nextjs-plugin

Step 2

Add the following to .env:

GRAFBASE_API_URL=http://localhost:4000/graphql
# OR
# NEXT_PUBLIC_GRAFBASE_API_URL=http://localhost:4000/graphql

Step 3

Then inside next.config.js import withGrafbase, and wrap your exported config:

/** @type {import('next').NextConfig} */

const { withGrafbase } = require('@grafbase/nextjs-plugin')

const nextConfig = () =>
  withGrafbase({
    reactStrictMode: true,
    swcMinify: true
  })

module.exports = nextConfig

Finally run your Next.js app! The Grafbase CLI will be running with your backend.

Notes

If there is no environment variable the Grafbase CLI will not start.

Readme

Keywords

none

Package Sidebar

Install

npm i @grafbase/nextjs-plugin

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

5.3 kB

Total Files

5

Last publish

Collaborators

  • pimeys
  • grafbase-ci
  • yoav-lavi-grafbase
  • fbjork