From e08fc5ef06bbb36f4905f58f9ad45c05266c6103 Mon Sep 17 00:00:00 2001 From: Jachin Date: Mon, 22 Sep 2025 00:08:30 +0800 Subject: [PATCH] feat(server): change the playground option to GraphiQL. (#13451) ## Summary by CodeRabbit * **New Features** * The GraphQL interactive UI is now available only in development environments and will not be accessible in production. This change affects only the availability of the interactive interface; public exports and API context types remain unchanged. Users in development can continue to use the tool as before, while production deployments will no longer expose the interactive UI. Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com> --- packages/backend/server/src/base/graphql/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/server/src/base/graphql/index.ts b/packages/backend/server/src/base/graphql/index.ts index 8f8811bc9..57da5da3f 100644 --- a/packages/backend/server/src/base/graphql/index.ts +++ b/packages/backend/server/src/base/graphql/index.ts @@ -8,6 +8,7 @@ import { Global, Module } from '@nestjs/common'; import { GraphQLModule } from '@nestjs/graphql'; import type { Request, Response } from 'express'; +import { NodeEnv } from '../../env'; import { Config } from '../config'; import { mapAnyError } from '../nestjs/exception'; import { GQLLoggerPlugin } from './logger-plugin'; @@ -30,7 +31,7 @@ export type GraphqlContext = { numberScalarMode: 'integer', }, useGlobalPrefix: true, - playground: true, + graphiql: env.NODE_ENV === NodeEnv.Development, sortSchema: true, autoSchemaFile: join( env.projectRoot,