Skip to main content
GraphQL is opt-in. New FrogBot apps serve only the REST API until you add two route files. Everything they need already ships with @frogbotai/next, so there’s nothing to install.

Add the routes

Create the GraphQL endpoint:
src/app/(frogbot)/api/graphql/route.ts
Then create the GraphQL playground:
src/app/(frogbot)/api/graphql-playground/route.ts
Restart your dev server. Your API now answers at /api/graphql, and the playground is at /api/graphql-playground:
GraphQL requests follow the same access control as REST: a query returns only the documents the signed-in user could read over REST. The OPTIONS export answers CORS preflight requests with the same headers as your REST routes. If you change routes.graphQL or routes.graphQLPlayground in your FrogBot config, rename the route folders to match. For example, routes: { graphQL: '/gql' } needs src/app/(frogbot)/api/gql/route.ts.

Production defaults

In production, the playground returns 404 and introspection queries are rejected. Regular queries and mutations keep working. To turn either back on, set graphQL.disablePlaygroundInProduction or graphQL.disableIntrospectionInProduction to false in your FrogBot config. See GraphQL options.

Turn GraphQL off

Set graphQL.disable: true to make /api/graphql return 404. This setting doesn’t remove the playground page in development, so delete the graphql-playground route file as well if you don’t want it served. To remove GraphQL completely, delete both route files.

What’s in the schema

The schema includes your collections and FrogBot’s public built-in collections, such as chats and messages. A files collection appears when your app marks one with file: true. FrogBot’s internal collections (chat turns, chat assets, trigger subscriptions, and durable waits) and internal records such as admin preferences, document locks, jobs, and key-value storage aren’t part of it.
Don’t point a single-collection relationship or upload field at one of FrogBot’s internal collections, such as frogbot-chat-assets. Those collections aren’t in the GraphQL schema, so the schema can’t be built.
To write the schema to a file for frontend code generation, see GraphQL schema.