Skip to content

Releases: productdevbook/nitro-graphql

v2.0.0-beta.34

03 Dec 19:45

Choose a tag to compare

v2.0.0-beta.34 Pre-release
Pre-release

No significant changes

    View changes on GitHub

v2.0.0-beta.33

03 Dec 17:31

Choose a tag to compare

v2.0.0-beta.33 Pre-release
Pre-release

❄️ 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!
         
    ❄️  ❄️  ❄️  ❄️  ❄️  ❄️  ❄️  ❄️  ❄️

📖 Docs · 🐛 Issues · 💬 Discussions


📋 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

03 Dec 19:44

Choose a tag to compare

No significant changes

    View changes on GitHub

v1.6.0

03 Dec 17:19

Choose a tag to compare

Winter Release

Snowflake

✨ 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: defineType still 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

📜 Full Changelog

Compare: v1.5.0...v1.6.0


Footer

Happy coding!

v1.5.0

22 Oct 19:23

Choose a tag to compare

   🚀 Features

Adds a new comprehensive debug dashboard at /_nitro/graphql/debug for inspecting GraphQL setup, resolver exports, and generated virtual modules.

CleanShot 2025-10-22 at 22 19 29@2x

   🐞 Bug Fixes

    View changes on GitHub

v1.4.0

05 Sep 07:07

Choose a tag to compare

   🚀 Features

    View changes on GitHub

v1.3.0

26 Aug 12:47

Choose a tag to compare

   🚨 Breaking Changes

   🚀 Features

   🐞 Bug Fixes

    View changes on GitHub

v1.2.0

21 Aug 13:58

Choose a tag to compare

   🚀 Features

    View changes on GitHub

v1.1.0

26 Jul 09:30

Choose a tag to compare

   🚨 Breaking Changes

   🚀 Features

   🐞 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

19 Jul 07:40

Choose a tag to compare

🚀 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 definitions
  • defineQuery() - Query-only resolvers
  • defineMutation() - Mutation-only resolvers
  • defineSubscription() - Real-time subscriptions
  • defineType() - Custom type resolvers
  • defineSchema() - 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 graphql

Configuration

// 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

🎉 Get Started Today

npx create-nitro-app my-graphql-app
cd my-graphql-app
pnpm add nitro-graphql graphql-yoga graphql

Ready 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...
Read more