Releases: productdevbook/nitro-graphql
v2.0.0-beta.34
No significant changes
View changes on GitHub
v2.0.0-beta.33
❄️ Nitro GraphQL v2.0.0-beta.33 ❄️
A Fresh Winter Release ✨
* . * . * . * . * . *
. ❄️ . ❄️ . ❄️ . ❄️
. * . * . * . * . *
❄️ ❄️ ❄️ ❄️
The first public beta of the next generation Nitro GraphQL!
🎉 What's New in v2?
This is a complete rewrite bringing modern framework support and powerful new features. If you're coming from v1.x, this is a significant upgrade!
⚡ Core Framework Migration
| Before (v1) | After (v2) |
|---|---|
| Nitro v2 | Nitro v3 |
| H3 v1 | H3 v2 |
| Nitro Module only | Vite Plugin + Nitro Module |
| Limited path control | Full path customization |
✨ Major Features
🔌 Dual Plugin Architecture
The module now works as both a Vite Plugin AND a Nitro Module:
// vite.config.ts
import graphql from 'nitro-graphql'
import { nitro } from 'nitro/vite'
export default defineConfig({
plugins: [
graphql(), // Must be before nitro()
nitro()
]
})🎛️ Full File Generation Control
Complete control over every generated file:
graphql: {
scaffold: {
graphqlConfig: false, // Skip graphql.config.ts
serverSchema: 'lib/schema.ts', // Custom path
},
paths: {
serverGraphql: 'packages/api/graphql',
clientGraphql: 'packages/web/graphql',
}
}🛠️ New Debug Dashboard
Visual debugging at `/_nitro/graphql/debug` (dev mode):
- Inspect loaded schemas
- View registered resolvers
- Check virtual file system
- Monitor configuration
🚀 Smart Chunk Optimization
GraphQL code now split into optimized chunks:
- ~98% size reduction in main bundle
- Automatic chunking for schemas, resolvers, directives
- Rolldown-ready for Vite 7+
📦 Client Utilities with ofetch
Modern client generation using `ofetch`:
// Auto-generated SDK
import { sdk } from '#graphql/client'
const { data } = await sdk.getUser({ id: '1' })🔧 Breaking Changes from v1
Import Path Changes
// ❌ Before (v1)
import { defineQuery } from 'nitro-graphql'
import { something } from 'h3'
// ✅ After (v2)
import { defineQuery } from 'nitro-graphql/define'
import { something } from 'nitro/h3'Context Declaration
// server/graphql/context.d.ts
declare module 'nitro/h3' {
interface H3EventContext {
// Your custom context
}
}API Renames
- `defineType()` → `defineField()`
🐛 Bug Fixes
-
Type System Improvements
- Handle `__typename` property correctly
- Better literal type inference
- Enhanced `ResolverReturnType` helper
-
Framework Fixes
- Custom status codes in GraphQL Yoga responses
- Apollo Server multiple `start()` calls resolved
- Custom type paths respected in TS config
📚 New Examples & Documentation
📖 Documentation Site
Live at nitro-graphql.pages.dev
🎮 New Examples
- Drizzle ORM - Full database integration with Docker
- Better Auth - Authentication middleware pattern
- Vite + React - Modern React SPA setup
- Vite + Vue - Vue 3 integration
📦 Installation
# npm
npm install nitro-graphql@beta graphql graphql-yoga
# pnpm
pnpm add nitro-graphql@beta graphql graphql-yoga
# yarn
yarn add nitro-graphql@beta graphql graphql-yoga🏗️ Architecture Improvements
❄️ Modularized Setup (15 orchestrated steps)
❄️ AST-based resolver scanning with oxc-parser
❄️ Virtual modules for runtime imports
❄️ Multi-layer Nuxt support
❄️ Apollo Federation subgraph support
❄️ External GraphQL service types
🙏 Contributors
@productdevbook & Claude AI 🤖
❄️ ❄️ ❄️ ❄️ ❄️ ❄️ ❄️ ❄️ ❄️
Happy coding this winter!
❄️ ❄️ ❄️ ❄️ ❄️ ❄️ ❄️ ❄️ ❄️
📋 Full Changelog
🚀 Features
- Add full file generation control and custom path system - #43
- Migrate to Nitro v3 and H3 v2 with Vite support - #40
- Add Nitro v3 Vite plugin integration with nitro: hook - #50
- Add comprehensive GraphQL debug dashboard - #42
- Add Apollo Federation subgraph support - #34
- Modularize codebase and improve code generation - #56
- Update client utils generation to support all frameworks
- Update client generation to use 'ofetch'
- Improve chunk naming logic for better optimization
- Add `defineField()` function for type resolvers
🐞 Bug Fixes
- Respect custom type paths in TypeScript configuration - #48
- Handle custom status codes in GraphQL Yoga response
- Resolve Apollo Server multiple start() calls issue - #39
- Integrate Apollo Federation support in type generation - #37
- Enhance ResolverReturnType to handle __typename and literal types
- Update imports from 'h3' to 'nitro/h3'
📖 Documentation
- Add comprehensive VitePress documentation site - #47
- Improve resolver error detection and documentation - #41
🧪 Examples
- Add Drizzle ORM integration example with Docker
- Add Better Auth session middleware example
- Add Vite + React integration example
- Add Vite + Vue integration example
- Add Nitro standalone example
Full Changelog: v1.5.0...v2.0.0-beta.33
v1.6.1
No significant changes
View changes on GitHub
v1.6.0
✨ What's New
🎁 defineField Function
A brand new way to define your GraphQL field resolvers!
// ✅ New way (recommended)
export const myResolver = defineField({
User: {
fullName: (parent) => `${parent.firstName} ${parent.lastName}`
}
})
// ⚠️ Old way (deprecated)
export const myResolver = defineType({ ... })💡 Note:
defineTypestill works but will be removed in a future version
🐛 Bug Fixes
- 🔧 Fixed custom type paths in TypeScript configuration (#48)
📊 Release Info
| 🏷️ Version 1.6.0 |
📅 Date Dec 2025 |
📦 Package npm |
v1.5.0
🚀 Features
Adds a new comprehensive debug dashboard at /_nitro/graphql/debug for inspecting GraphQL setup, resolver exports, and generated virtual modules.
- Improve resolver error detection and documentation - by @productdevbook and Claude in #41 (fb034)
- Add comprehensive GraphQL debug dashboard with VFS inspection - by @productdevbook and Claude in #42 (02f51)
🐞 Bug Fixes
- Generate _directives.graphql - by @productdevbook (f79d9)
- Integrate Apollo Federation support in type generation - by @productdevbook in #37 (c70e1)
- Resolve Apollo Server multiple start() calls issue - by @productdevbook in #39 (aceee)
View changes on GitHub
v1.4.0
🚀 Features
- Add comprehensive Nuxt layer support with codebase cleanup - by @productdevbook in #36 (0e746)
- Add Apollo Federation subgraph support - by @productdevbook in #34 (ba6c6)
View changes on GitHub
v1.3.0
🚨 Breaking Changes
- Move Apollo Server dependencies to optional peerDependencies - by @productdevbook in #29 (d2596)
🚀 Features
- Auto-create app/graphql directory for Nuxt projects - by @productdevbook in #24 (d2ae7)
- Add defineDirective utility for custom GraphQL directives - by @productdevbook in #21 (520e1)
- Add comprehensive GraphQL type conflict detection with duplicate type validation - by @productdevbook in #30 (9d416)
🐞 Bug Fixes
- Improve external GraphQL services and smart default handling - by @productdevbook in #25 (8b565)
- Improve ofetch.ts generation logic for external services - by @productdevbook in #27 (a91a1)
- Exclude external service documents from main client type generation - by @productdevbook in #31 (2032a)
View changes on GitHub
v1.2.0
🚀 Features
- Update context.ts structure and add migration warning - by @productdevbook in #19 (07820)
- Multi-Service GraphQL Support with Default Folder Organization & Schema Caching - by @productdevbook in #23 (293e0)
View changes on GitHub
v1.1.0
🚨 Breaking Changes
- Server context type - by @productdevbook in #16 (df4d0)
🚀 Features
- Enable enums as types in code generation configuration - by @productdevbook in #14 (f18f8)
- Enhance GraphQL SDK with execution result types and code - by @productdevbook in #15 (e9001)
- Ensure directories are created before writing client type files - by @productdevbook (bab31)
- Integrate GraphQL scalars into client and server code generation - by @productdevbook (d925c)
🐞 Bug Fixes
- Correct order of arguments in defu for merged configuration in client and server code generation - by @productdevbook (246d7)
View changes on GitHub
v1.0.0
🚀 Nitro GraphQL v1.0.0 - Production Ready Release
"GraphQL is not just a query language; it's a new way to think about APIs and client-server interaction."
We're thrilled to announce Nitro GraphQL v1.0.0 - the first stable release of our comprehensive GraphQL integration for the Nitro ecosystem! This milestone represents months of development, community feedback, and battle-testing to create the most developer-friendly GraphQL solution for Nitro-powered applications.
🎯 What is Nitro GraphQL?
Nitro GraphQL is a standalone module that seamlessly integrates GraphQL servers into any Nitro-based application with automatic type generation, file watching, and zero-configuration setup. Whether you're building with Nuxt, standalone Nitro, or any other Nitro-compatible framework, you can now add a production-ready GraphQL API in minutes.
✨ What's New in v1.0.0
🚀 Production-Ready Stability
- Battle-tested architecture with comprehensive error handling
- Memory-optimized hot reloading for development
- Production-ready bundling with smart chunking and dynamic imports
- Enhanced type safety throughout the entire codebase
🔧 Auto-Generated Client SDK (v0.5.0+)
One of our biggest features - automatic generation of type-safe GraphQL clients for Nuxt applications:
// Automatically generated from your GraphQL files
import { createGraphQLClient } from '#graphql/client'
const client = createGraphQLClient()
const { users } = await client.GetUsers() // Fully typed!📝 Enhanced Type Generation
- Server types: Complete TypeScript definitions for resolvers and schema (
#graphql/server) - Client types: Auto-generated operation types and SDK (
#graphql/client) - Hot reload support: Types update automatically during development
- Improved codegen options for better type safety and performance
🎮 Developer Experience Improvements
- Named export pattern: Export multiple resolvers from single files
- Auto-discovery: Automatically scans and loads GraphQL files
- Zero configuration: Sensible defaults with optional customization
- File-based organization: Domain-driven resolver and schema structure
- Built-in Apollo Sandbox: Interactive GraphQL playground
🌐 Universal Framework Support
Works seamlessly with any Nitro-powered framework:
- Nuxt.js: First-class integration with dedicated module
- Standalone Nitro: Direct integration for custom applications
- Any Nitro-compatible framework: Universal compatibility
🏗️ Key Features
Multi-Framework GraphQL Support
- GraphQL Yoga: Lightweight, performant GraphQL server
- Apollo Server: Enterprise-grade GraphQL implementation
- Seamless switching between frameworks
Intelligent File Organization
server/graphql/
├── schema.graphql # Main schema
├── users/
│ ├── user.graphql # User schema
│ ├── user-queries.resolver.ts
│ └── create-user.resolver.ts
└── posts/
├── post.graphql
└── post-queries.resolver.ts
Powerful Utilities
defineResolver()- Complete resolver definitionsdefineQuery()- Query-only resolversdefineMutation()- Mutation-only resolversdefineSubscription()- Real-time subscriptionsdefineType()- Custom type resolversdefineSchema()- Schema validation with Zod/Valibot
Type-Safe Development
Auto-generated TypeScript types for seamless development:
Server-side types (#graphql/server):
import type { User, Post, CreateUserInput } from '#graphql/server'
export const userResolver = defineResolver({
Query: {
users: async (): Promise<User[]> => {
return await db.users.findMany() // Fully typed
}
}
})Client-side types (#graphql/client):
import type { GetUsersQuery, CreateUserInput } from '#graphql/client'
const users = ref<GetUsersQuery['users']>([])
const createUser = async (input: CreateUserInput) => {
return await client.CreateUser({ input }) // Type-safe
}Advanced Features
- Custom scalars (DateTime, JSON, etc.)
- Error handling patterns
- Authentication & authorization
- Database integration (Prisma, Drizzle compatible)
- Health check endpoints
📊 Performance & Reliability
Optimized for Production
- Smart bundling: Efficient code splitting for optimal performance
- Memory management: Optimized hot reloading without memory leaks
- Type caching: Intelligent type generation caching
- Minimal overhead: Lightweight runtime with maximum functionality
Enhanced Error Handling
- Comprehensive error reporting during development
- Production-safe error messages
- Type-safe error handling in resolvers
- Detailed logging for debugging
🔄 Migration & Breaking Changes
Named Exports (Breaking Change)
The module now requires named exports for all resolvers:
// ❌ v0.x (deprecated)
export default defineResolver({ ... })
// ✅ v1.0.0 (required)
export const userResolver = defineResolver({ ... })
export const postResolver = defineResolver({ ... })Updated Import Paths
More explicit import paths for better developer experience:
// Import utilities
import { defineResolver } from 'nitro-graphql/utils/define'
// Auto-imports still work (recommended)
export const resolver = defineResolver({ ... })🚀 Quick Start
Installation
# Choose your GraphQL framework
pnpm add nitro-graphql graphql-yoga graphql
# or
pnpm add nitro-graphql @apollo/server graphqlConfiguration
// nitro.config.ts
export default defineNitroConfig({
modules: ['nitro-graphql'],
graphql: {
framework: 'graphql-yoga', // or 'apollo-server'
},
})Your First Schema
# server/graphql/schema.graphql
type Query {
hello: String!
users: [User!]!
}
type User {
id: ID!
name: String!
email: String!
}Your First Resolver
// server/graphql/hello.resolver.ts
export const helloResolver = defineResolver({
Query: {
hello: () => 'Hello from GraphQL!',
users: async (_, __, { storage }) => {
return await storage.getItem('users') || []
},
},
})That's it! Your GraphQL API is ready at /api/graphql 🎉
📈 Community & Ecosystem Growth
Growing Adoption
- Production deployments across various industries
- Active community contributing features and improvements
- Framework integrations expanding the ecosystem
Community Contributions
Special thanks to our contributors who helped make v1.0.0 possible:
- Enhanced type safety improvements
- Client SDK development
- Documentation enhancements
- Bug fixes and performance optimizations
🔮 What's Next?
Planned Features
- Subscription support for real-time applications
- Advanced caching strategies
- Database adapter ecosystem (Prisma, Drizzle, etc.)
- VS Code extension for enhanced development
- Performance monitoring tools
Community Roadmap
- Framework examples and integrations
- Video tutorials and learning resources
- Testing utilities and best practices
- Deployment guides for various platforms
🙏 Acknowledgments
This release wouldn't be possible without:
- Our amazing community for feedback and contributions
- The Nitro team for building an incredible foundation
- GraphQL ecosystem maintainers for excellent tooling
- Early adopters who tested and provided valuable feedback
🚨 Important Notes
Node.js Requirements
- Node.js 20.x or later required
- pnpm recommended as package manager
- Corepack enabled for optimal experience
TypeScript Support
- Full TypeScript support with auto-generated types
- IDE integration with IntelliSense and autocompletion
- Type safety from schema to runtime
📚 Resources
- 📖 Documentation - Complete guides and API reference
- 🎮 Playground - Try it yourself
- 💬 Community - Join the discussion
- 🐛 Issues - Report bugs or request features
🎉 Get Started Today
npx create-nitro-app my-graphql-app
cd my-graphql-app
pnpm add nitro-graphql graphql-yoga graphqlReady to revolutionize your API development? Nitro GraphQL v1.0.0 brings the power of GraphQL to the Nitro ecosystem with unmatched developer experience and production-ready reliability.
Happy coding! 🚀
The Nitro GraphQL Team
📋 Full Changelog
v1.0.0 (2024-12-XX)
- 🎉 MAJOR: First stable release
- 🚀 FEAT: Production-ready architecture
- 📝 DOCS: Updated README with GraphQL philosophy
- 🔧 BREAKING: Named exports required for resolvers
- ⚡ PERF: Optimized bundling and memory usage
v0.5.0 (Previous)
- 🚀 FEAT: Auto-generate Nuxt ofetch GraphQL client for quick start
- 📦 DEPS: Update dependencies in pnpm-workspace.yaml
v0.4.0 (Previous)
- 🛠️ FIX: Remove unused GraphQL mutation variable types from SDK
- 🔧 FEAT: Add codegen options to client type generation
- 🔥 FIX: Hot reload client types
- 🎯 FIX: Improve type definitions for server options
v0.3.0 (Previous)
- 🚀 FEAT: Create default GraphQL server directory and examples
- 🔧 FIX: Update GraphQL schema definitions
- 📝 DOCS: Add...
