feat: add server: false mode and simplify external services config
#60
+314
−243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces two major improvements to nitro-graphql:
1. Client-Only Mode (
server: false)A new configuration option that allows using nitro-graphql purely as a client-side type generator without including any server-side GraphQL code.
Use case: When you want to consume external GraphQL APIs without running your own GraphQL server.
What gets disabled:
/api/graphql,/api/graphql/health)#graphql/server)schema.ts,config.ts,context.ts)defineResolver, etc.)What still works:
#graphql/client/{serviceName})2. Simplified External Services Configuration
Reduced the required configuration from 4+ fields to just 2 fields for the common case.
Before (verbose):
After (simple):
Smart defaults:
schemadefaults toendpointif not specifieddownloadSchemadefaults totruefor URL schemas (enables offline caching)Advanced options still available:
3. Bug Fixes
watchDirsentry for the client directory in Nitro (non-Nuxt) projectsdev:reloadhook for client-only mode to ensure file changes trigger type regenerationTest plan
server: falsewith external service - types and SDK generated correctly🤖 Generated with Claude Code