nitro-graphql 2.0.0-beta.7 → 2.0.0-beta.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1196
- package/dist/cli/adapter.d.mts +13 -0
- package/dist/cli/adapter.mjs +67 -0
- package/dist/cli/commands/build.d.mts +21 -0
- package/dist/cli/commands/build.mjs +50 -0
- package/dist/cli/commands/dev.d.mts +40 -0
- package/dist/cli/commands/dev.mjs +74 -0
- package/dist/cli/commands/generate.d.mts +25 -0
- package/dist/cli/commands/generate.mjs +198 -0
- package/dist/cli/commands/index.d.mts +5 -0
- package/dist/cli/commands/index.mjs +5 -0
- package/dist/cli/commands/init.d.mts +45 -0
- package/dist/cli/commands/init.mjs +195 -0
- package/dist/cli/commands/validate.d.mts +9 -0
- package/dist/cli/commands/validate.mjs +65 -0
- package/dist/cli/completions.d.mts +6 -0
- package/dist/cli/completions.mjs +32 -0
- package/dist/cli/config.d.mts +18 -0
- package/dist/cli/config.mjs +19 -0
- package/dist/cli/index.d.mts +26 -0
- package/dist/cli/index.mjs +315 -0
- package/dist/cli/server/debug-handler.d.mts +9 -0
- package/dist/cli/server/debug-handler.mjs +68 -0
- package/dist/cli/server/dev-server.d.mts +29 -0
- package/dist/cli/server/dev-server.mjs +62 -0
- package/dist/cli/server/graphql-handler.d.mts +21 -0
- package/dist/cli/server/graphql-handler.mjs +43 -0
- package/dist/cli/server/health-handler.d.mts +12 -0
- package/dist/cli/server/health-handler.mjs +29 -0
- package/dist/cli/server/loader.d.mts +33 -0
- package/dist/cli/server/loader.mjs +144 -0
- package/dist/cli/server/sandbox-handler.d.mts +12 -0
- package/dist/cli/server/sandbox-handler.mjs +17 -0
- package/dist/cli/server/watcher.d.mts +20 -0
- package/dist/cli/server/watcher.mjs +64 -0
- package/dist/cli/server/ws-handler.d.mts +28 -0
- package/dist/cli/server/ws-handler.mjs +48 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +2 -0
- package/dist/core/codegen/client.d.mts +42 -0
- package/dist/core/codegen/client.mjs +551 -0
- package/dist/core/codegen/document-loader.d.mts +9 -0
- package/dist/core/codegen/document-loader.mjs +16 -0
- package/dist/core/codegen/index.d.mts +8 -0
- package/dist/core/codegen/index.mjs +8 -0
- package/dist/core/codegen/plugin.d.mts +19 -0
- package/dist/core/codegen/plugin.mjs +29 -0
- package/dist/core/codegen/runtime.d.mts +17 -0
- package/dist/core/codegen/runtime.mjs +61 -0
- package/dist/core/codegen/schema-loader.d.mts +27 -0
- package/dist/core/codegen/schema-loader.mjs +126 -0
- package/dist/core/codegen/server.d.mts +27 -0
- package/dist/core/codegen/server.mjs +142 -0
- package/dist/core/codegen/validation.d.mts +17 -0
- package/dist/core/codegen/validation.mjs +33 -0
- package/dist/core/config.d.mts +45 -0
- package/dist/core/config.mjs +76 -0
- package/dist/core/constants.d.mts +188 -0
- package/dist/core/constants.mjs +208 -0
- package/dist/core/debug/index.d.mts +2 -0
- package/dist/core/debug/index.mjs +2 -0
- package/dist/core/debug/template.d.mts +52 -0
- package/dist/core/debug/template.mjs +384 -0
- package/dist/core/extend/index.d.mts +2 -0
- package/dist/core/extend/index.mjs +2 -0
- package/dist/core/extend/loader.d.mts +40 -0
- package/dist/core/extend/loader.mjs +196 -0
- package/dist/core/index.d.mts +33 -0
- package/dist/core/index.mjs +28 -0
- package/dist/core/manifest.d.mts +56 -0
- package/dist/core/manifest.mjs +100 -0
- package/dist/core/pubsub/index.d.mts +109 -0
- package/dist/core/pubsub/index.mjs +146 -0
- package/dist/core/scanning/ast-scanner.d.mts +27 -0
- package/dist/core/scanning/ast-scanner.mjs +114 -0
- package/dist/core/scanning/common.d.mts +25 -0
- package/dist/core/scanning/common.mjs +57 -0
- package/dist/core/scanning/directives.d.mts +13 -0
- package/dist/core/scanning/directives.mjs +28 -0
- package/dist/core/scanning/documents.d.mts +20 -0
- package/dist/core/scanning/documents.mjs +36 -0
- package/dist/core/scanning/index.d.mts +7 -0
- package/dist/core/scanning/index.mjs +7 -0
- package/dist/core/scanning/resolvers.d.mts +14 -0
- package/dist/core/scanning/resolvers.mjs +58 -0
- package/dist/core/scanning/schemas.d.mts +13 -0
- package/dist/core/scanning/schemas.mjs +50 -0
- package/dist/core/schema/builder.d.mts +59 -0
- package/dist/core/schema/builder.mjs +76 -0
- package/dist/core/schema/federation.d.mts +33 -0
- package/dist/core/schema/federation.mjs +38 -0
- package/dist/core/schema/index.d.mts +3 -0
- package/dist/core/schema/index.mjs +3 -0
- package/dist/core/server/index.d.mts +4 -0
- package/dist/core/server/index.mjs +3 -0
- package/dist/core/server/sandbox.d.mts +18 -0
- package/dist/core/server/sandbox.mjs +38 -0
- package/dist/core/server/types.d.mts +54 -0
- package/dist/core/server/types.mjs +1 -0
- package/dist/core/server/yoga.d.mts +42 -0
- package/dist/core/server/yoga.mjs +87 -0
- package/dist/core/types/adapter.d.mts +55 -0
- package/dist/core/types/adapter.mjs +1 -0
- package/dist/core/types/codegen.d.mts +136 -0
- package/dist/core/types/codegen.mjs +1 -0
- package/dist/core/types/config.d.mts +188 -0
- package/dist/core/types/config.mjs +1 -0
- package/dist/{utils/define.d.ts → core/types/define.d.mts} +2 -30
- package/dist/core/types/define.mjs +1 -0
- package/dist/core/types/index.d.mts +5 -0
- package/dist/core/types/index.mjs +1 -0
- package/dist/core/types/scanning.d.mts +64 -0
- package/dist/core/types/scanning.mjs +1 -0
- package/dist/{utils/directive-parser.d.ts → core/utils/directive-parser.d.mts} +18 -4
- package/dist/{utils/directive-parser.js → core/utils/directive-parser.mjs} +29 -36
- package/dist/core/utils/errors.d.mts +77 -0
- package/dist/core/utils/errors.mjs +91 -0
- package/dist/core/utils/file-io.d.mts +24 -0
- package/dist/core/utils/file-io.mjs +45 -0
- package/dist/core/utils/imports.d.mts +15 -0
- package/dist/core/utils/imports.mjs +24 -0
- package/dist/core/utils/index.d.mts +7 -0
- package/dist/core/utils/index.mjs +7 -0
- package/dist/core/utils/logger.d.mts +18 -0
- package/dist/core/utils/logger.mjs +36 -0
- package/dist/core/utils/ofetch-templates.d.mts +30 -0
- package/dist/core/utils/ofetch-templates.mjs +134 -0
- package/dist/core/utils/runtime.d.mts +74 -0
- package/dist/core/utils/runtime.mjs +109 -0
- package/dist/core/utils/subscribe-templates.d.mts +8 -0
- package/dist/core/utils/subscribe-templates.mjs +58 -0
- package/dist/core/validation/external-services.d.mts +11 -0
- package/dist/core/validation/external-services.mjs +33 -0
- package/dist/core/validation/index.d.mts +2 -0
- package/dist/core/validation/index.mjs +2 -0
- package/dist/core/watcher/index.d.mts +107 -0
- package/dist/core/watcher/index.mjs +140 -0
- package/dist/define.d.mts +294 -0
- package/dist/define.mjs +323 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +5 -0
- package/dist/nitro/adapter.d.mts +28 -0
- package/dist/nitro/adapter.mjs +90 -0
- package/dist/{utils/apollo.d.ts → nitro/apollo.d.mts} +3 -3
- package/dist/nitro/apollo.mjs +57 -0
- package/dist/nitro/codegen.d.mts +18 -0
- package/dist/nitro/codegen.mjs +171 -0
- package/dist/nitro/config.d.mts +50 -0
- package/dist/nitro/config.mjs +55 -0
- package/dist/nitro/index.d.mts +45 -0
- package/dist/nitro/index.mjs +63 -0
- package/dist/{utils/path-resolver.d.ts → nitro/paths.d.mts} +8 -25
- package/dist/nitro/paths.mjs +97 -0
- package/dist/nitro/rollup.d.mts +6 -0
- package/dist/nitro/rollup.mjs +52 -0
- package/dist/nitro/routes/apollo-sandbox-script.d.mts +6 -0
- package/dist/nitro/routes/apollo-sandbox-script.mjs +12 -0
- package/dist/nitro/routes/apollo-server-ws.d.mts +15 -0
- package/dist/nitro/routes/apollo-server-ws.mjs +50 -0
- package/dist/nitro/routes/apollo-server.d.mts +6 -0
- package/dist/nitro/routes/apollo-server.mjs +69 -0
- package/dist/{routes/debug.d.ts → nitro/routes/debug.d.mts} +12 -19
- package/dist/nitro/routes/debug.mjs +98 -0
- package/dist/nitro/routes/graphql-yoga-ws.d.mts +12 -0
- package/dist/nitro/routes/graphql-yoga-ws.mjs +50 -0
- package/dist/nitro/routes/graphql-yoga.d.mts +12 -0
- package/dist/nitro/routes/graphql-yoga.mjs +39 -0
- package/dist/nitro/routes/health.d.mts +10 -0
- package/dist/{routes/health.js → nitro/routes/health.mjs} +5 -6
- package/dist/nitro/setup/extend-loader.d.mts +16 -0
- package/dist/nitro/setup/extend-loader.mjs +80 -0
- package/dist/nitro/setup/file-watcher.d.mts +18 -0
- package/dist/nitro/setup/file-watcher.mjs +62 -0
- package/dist/nitro/setup/logging.d.mts +16 -0
- package/dist/nitro/setup/logging.mjs +64 -0
- package/dist/nitro/setup/rollup-integration.d.mts +24 -0
- package/dist/nitro/setup/rollup-integration.mjs +64 -0
- package/dist/nitro/setup/routes.d.mts +13 -0
- package/dist/nitro/setup/routes.mjs +69 -0
- package/dist/nitro/setup/scanner.d.mts +59 -0
- package/dist/nitro/setup/scanner.mjs +118 -0
- package/dist/nitro/setup/ts-config.d.mts +10 -0
- package/dist/nitro/setup/ts-config.mjs +67 -0
- package/dist/nitro/setup.d.mts +11 -0
- package/dist/nitro/setup.mjs +189 -0
- package/dist/nitro/types.d.mts +549 -0
- package/dist/nitro/types.mjs +1 -0
- package/dist/nitro/virtual/generators.d.mts +38 -0
- package/dist/nitro/virtual/generators.mjs +190 -0
- package/dist/nitro/virtual/stubs.d.mts +21 -0
- package/dist/nitro/virtual/stubs.mjs +31 -0
- package/dist/{ecosystem/nuxt.d.ts → nuxt.d.mts} +1 -1
- package/dist/nuxt.mjs +111 -0
- package/dist/{graphql/server.d.ts → stubs/index.d.mts} +5 -1
- package/dist/stubs/index.mjs +1 -0
- package/dist/subscribe/index.d.mts +78 -0
- package/dist/subscribe/index.mjs +205 -0
- package/native/index.d.ts +20 -0
- package/native/index.js +585 -0
- package/package.json +202 -112
- package/dist/ecosystem/nuxt.js +0 -67
- package/dist/graphql/index.d.ts +0 -5
- package/dist/graphql/index.js +0 -1
- package/dist/graphql/server.js +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -318
- package/dist/rollup.js +0 -277
- package/dist/routes/apollo-server.d.ts +0 -6
- package/dist/routes/apollo-server.js +0 -89
- package/dist/routes/debug.js +0 -449
- package/dist/routes/graphql-yoga.d.ts +0 -6
- package/dist/routes/graphql-yoga.js +0 -91
- package/dist/routes/health.d.ts +0 -10
- package/dist/types/index.d.ts +0 -246
- package/dist/types/standard-schema.d.ts +0 -59
- package/dist/utils/apollo.js +0 -61
- package/dist/utils/client-codegen.d.ts +0 -38
- package/dist/utils/client-codegen.js +0 -290
- package/dist/utils/define.js +0 -57
- package/dist/utils/file-generator.d.ts +0 -37
- package/dist/utils/file-generator.js +0 -72
- package/dist/utils/index.d.ts +0 -39
- package/dist/utils/index.js +0 -278
- package/dist/utils/path-resolver.js +0 -127
- package/dist/utils/server-codegen.d.ts +0 -7
- package/dist/utils/server-codegen.js +0 -136
- package/dist/utils/type-generation.d.ts +0 -7
- package/dist/utils/type-generation.js +0 -360
- package/dist/virtual/debug-info.d.ts +0 -9
- package/dist/virtual/debug-info.js +0 -26
- package/dist/virtual/graphql-config.d.ts +0 -9
- package/dist/virtual/graphql-config.js +0 -10
- package/dist/virtual/module-config.d.ts +0 -9
- package/dist/virtual/module-config.js +0 -10
- package/dist/virtual/server-directives.d.ts +0 -11
- package/dist/virtual/server-directives.js +0 -10
- package/dist/virtual/server-resolvers.d.ts +0 -11
- package/dist/virtual/server-resolvers.js +0 -10
- package/dist/virtual/server-schemas.d.ts +0 -11
- package/dist/virtual/server-schemas.js +0 -10
- package/dist/vite.d.ts +0 -25
- package/dist/vite.js +0 -40
package/README.md
CHANGED
|
@@ -1,1230 +1,63 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="./.
|
|
3
|
+
<img src="./.github/assets/logo.svg" alt="Nitro GraphQL Logo" width="120" height="120">
|
|
4
4
|
|
|
5
5
|
# Nitro GraphQL
|
|
6
6
|
|
|
7
7
|
[![npm version][npm-version-src]][npm-version-href]
|
|
8
|
+
[![Beta Status][beta-src]][beta-href]
|
|
8
9
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
|
-
[![
|
|
10
|
+
[![Coverage][coverage-src]][coverage-href]
|
|
10
11
|
[![License][license-src]][license-href]
|
|
11
12
|
[![Documentation][docs-src]][docs-href]
|
|
12
13
|
|
|
13
14
|
**The easiest way to add GraphQL to any Nitro application**
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[📚 Documentation](https://nitro-graphql.pages.dev) • [Quick Start](#-quick-start) • [Examples](#-examples) • [Community](#-community)
|
|
16
|
+
[Documentation](https://nitro-graphql.pages.dev) | [Examples](./examples/) | [Playgrounds](./playgrounds/)
|
|
18
17
|
|
|
19
18
|
</div>
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## 🎥 Watch & Learn
|
|
24
|
-
|
|
25
|
-
- [**Nuxt 4 Integration**](https://x.com/productdevbook/status/1947314569531076633) - Step-by-step Nuxt setup
|
|
26
|
-
- [**Standalone Nitro**](https://x.com/productdevbook/status/1945759751393976348) - Basic Nitro integration
|
|
27
|
-
|
|
28
|
-
## ✨ Why Nitro GraphQL?
|
|
29
|
-
|
|
30
|
-
- ⚡ **5-minute setup** - From zero to GraphQL in minutes
|
|
31
|
-
- 🔍 **Auto-discovery** - Scans your files, builds your schema
|
|
32
|
-
- 📝 **Type-safe** - Full TypeScript support with auto-generated types
|
|
33
|
-
- 🎯 **Universal** - Works with Nuxt, Nitro, and any Nitro-based framework
|
|
34
|
-
- 🎮 **Developer-friendly** - Built-in Apollo Sandbox for testing
|
|
35
|
-
- 🔧 **Zero config** - Sensible defaults, customize when needed
|
|
20
|
+
> [!IMPORTANT]
|
|
21
|
+
> **v2.0 Beta** - Nitro v3 / H3 v2 support. For v1.x (Nitro v2), see the [`v1` branch](https://github.com/productdevbook/nitro-graphql/tree/v1).
|
|
36
22
|
|
|
37
|
-
##
|
|
23
|
+
## Quick Start
|
|
38
24
|
|
|
39
|
-
### 1. Install
|
|
40
|
-
|
|
41
|
-
**GraphQL Yoga (recommended):**
|
|
42
25
|
```bash
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
**Apollo Server:**
|
|
47
|
-
```bash
|
|
48
|
-
pnpm add nitro-graphql @apollo/server @apollo/utils.withrequired @as-integrations/h3 graphql
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 2. Configure
|
|
52
|
-
|
|
53
|
-
<details>
|
|
54
|
-
<summary>🔧 <strong>Nitro Project</strong></summary>
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
// nitro.config.ts
|
|
58
|
-
import { defineNitroConfig } from 'nitro/config'
|
|
59
|
-
|
|
60
|
-
export default defineNitroConfig({
|
|
61
|
-
modules: ['nitro-graphql'],
|
|
62
|
-
graphql: {
|
|
63
|
-
framework: 'graphql-yoga', // or 'apollo-server'
|
|
64
|
-
},
|
|
65
|
-
})
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
</details>
|
|
69
|
-
|
|
70
|
-
<details>
|
|
71
|
-
<summary>⚡ <strong>Vite + Nitro Project</strong></summary>
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
// vite.config.ts
|
|
75
|
-
import { defineConfig } from 'vite'
|
|
76
|
-
import { nitro } from 'nitro/vite'
|
|
77
|
-
import { graphql } from 'nitro-graphql/vite'
|
|
78
|
-
|
|
79
|
-
export default defineConfig({
|
|
80
|
-
plugins: [
|
|
81
|
-
graphql(), // ⚠️ Must be before nitro()
|
|
82
|
-
nitro(),
|
|
83
|
-
],
|
|
84
|
-
nitro: {
|
|
85
|
-
modules: ['nitro-graphql'],
|
|
86
|
-
graphql: {
|
|
87
|
-
framework: 'graphql-yoga',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
})
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
> **⚠️ Important**: The `graphql()` plugin must be placed **before** `nitro()` to prevent Vite from trying to parse GraphQL files as JavaScript.
|
|
94
|
-
|
|
95
|
-
</details>
|
|
96
|
-
|
|
97
|
-
<details>
|
|
98
|
-
<summary>🟢 <strong>Nuxt Project</strong></summary>
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
// nuxt.config.ts
|
|
102
|
-
export default defineNuxtConfig({
|
|
103
|
-
modules: ['nitro-graphql/nuxt'],
|
|
104
|
-
nitro: {
|
|
105
|
-
graphql: {
|
|
106
|
-
framework: 'graphql-yoga',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
</details>
|
|
113
|
-
|
|
114
|
-
### 3. Create Your Schema
|
|
115
|
-
|
|
116
|
-
```graphql
|
|
117
|
-
# server/graphql/schema.graphql
|
|
118
|
-
type Query {
|
|
119
|
-
hello: String!
|
|
120
|
-
greeting(name: String!): String!
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
type Mutation {
|
|
124
|
-
_empty: String
|
|
125
|
-
}
|
|
26
|
+
npx nitro-graphql@beta init my-app -t nitro
|
|
126
27
|
```
|
|
127
28
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
```ts
|
|
131
|
-
// server/graphql/hello.resolver.ts
|
|
132
|
-
export const helloResolver = defineResolver({
|
|
133
|
-
Query: {
|
|
134
|
-
hello: () => 'Hello from GraphQL!',
|
|
135
|
-
greeting: (_, { name }) => `Hello, ${name}!`,
|
|
136
|
-
},
|
|
137
|
-
})
|
|
138
|
-
```
|
|
29
|
+
Available templates: `nitro`, `vite`, `vite-react`, `vite-vue`, `drizzle-orm`, `better-auth`
|
|
139
30
|
|
|
140
|
-
|
|
31
|
+
## Manual Installation
|
|
141
32
|
|
|
142
33
|
```bash
|
|
143
|
-
pnpm
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
🎉 **That's it!** Your GraphQL server is ready at:
|
|
147
|
-
- **Endpoint**: `http://localhost:3000/api/graphql`
|
|
148
|
-
- **Playground**: `http://localhost:3000/api/graphql` (browser)
|
|
149
|
-
- **Health**: `http://localhost:3000/api/graphql/health`
|
|
150
|
-
|
|
151
|
-
## 🎮 Examples
|
|
152
|
-
|
|
153
|
-
Try these working examples:
|
|
154
|
-
|
|
155
|
-
| Example | Description | Demo |
|
|
156
|
-
|---------|-------------|------|
|
|
157
|
-
| [**Nitro Basic**](./playgrounds/nitro/) | Standalone Nitro with GraphQL | `pnpm playground:nitro` |
|
|
158
|
-
| [**Vite + Nitro**](./playgrounds/vite/) | Vite with Nitro GraphQL integration | `cd playgrounds/vite && pnpm dev` |
|
|
159
|
-
| [**Nuxt Integration**](./playgrounds/nuxt/) | Full Nuxt app with client types | `pnpm playground:nuxt` |
|
|
160
|
-
| [**Apollo Federation**](./playgrounds/federation/) | Federated GraphQL services | `pnpm playground:federation` |
|
|
161
|
-
|
|
162
|
-
## 🏗️ Building Your First Feature
|
|
163
|
-
|
|
164
|
-
Let's create a complete user management system:
|
|
165
|
-
|
|
166
|
-
### 1. Define Schema
|
|
167
|
-
```graphql
|
|
168
|
-
# server/graphql/users/user.graphql
|
|
169
|
-
type User {
|
|
170
|
-
id: ID!
|
|
171
|
-
name: String!
|
|
172
|
-
email: String!
|
|
173
|
-
createdAt: DateTime!
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
input CreateUserInput {
|
|
177
|
-
name: String!
|
|
178
|
-
email: String!
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
extend type Query {
|
|
182
|
-
users: [User!]!
|
|
183
|
-
user(id: ID!): User
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
extend type Mutation {
|
|
187
|
-
createUser(input: CreateUserInput!): User!
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### 2. Create Resolvers
|
|
192
|
-
```ts
|
|
193
|
-
// server/graphql/users/user.resolver.ts
|
|
194
|
-
export const userQueries = defineQuery({
|
|
195
|
-
users: async (_, __, { storage }) => {
|
|
196
|
-
return await storage.getItem('users') || []
|
|
197
|
-
},
|
|
198
|
-
user: async (_, { id }, { storage }) => {
|
|
199
|
-
const users = await storage.getItem('users') || []
|
|
200
|
-
return users.find(user => user.id === id)
|
|
201
|
-
}
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
export const userMutations = defineMutation({
|
|
205
|
-
createUser: async (_, { input }, { storage }) => {
|
|
206
|
-
const users = await storage.getItem('users') || []
|
|
207
|
-
const user = {
|
|
208
|
-
id: Date.now().toString(),
|
|
209
|
-
...input,
|
|
210
|
-
createdAt: new Date()
|
|
211
|
-
}
|
|
212
|
-
users.push(user)
|
|
213
|
-
await storage.setItem('users', users)
|
|
214
|
-
return user
|
|
215
|
-
}
|
|
216
|
-
})
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### 3. Test in Apollo Sandbox
|
|
220
|
-
```graphql
|
|
221
|
-
mutation {
|
|
222
|
-
createUser(input: {
|
|
223
|
-
name: "John Doe"
|
|
224
|
-
email: "john@example.com"
|
|
225
|
-
}) {
|
|
226
|
-
id
|
|
227
|
-
name
|
|
228
|
-
email
|
|
229
|
-
createdAt
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
query {
|
|
234
|
-
users {
|
|
235
|
-
id
|
|
236
|
-
name
|
|
237
|
-
email
|
|
238
|
-
}
|
|
239
|
-
}
|
|
34
|
+
pnpm add nitro-graphql@beta graphql-yoga graphql graphql-config
|
|
240
35
|
```
|
|
241
36
|
|
|
242
|
-
## 🚀 Advanced Features
|
|
243
|
-
|
|
244
|
-
<details>
|
|
245
|
-
<summary><strong>🎛️ Custom File Generation & Paths</strong></summary>
|
|
246
|
-
|
|
247
|
-
Control which files are auto-generated and customize their output paths. Perfect for library development, monorepos, or custom project structures.
|
|
248
|
-
|
|
249
|
-
### Library Mode
|
|
250
|
-
|
|
251
|
-
Disable all scaffold files for library/module development:
|
|
252
|
-
|
|
253
37
|
```ts
|
|
254
38
|
// nitro.config.ts
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
framework: 'graphql-yoga',
|
|
258
|
-
scaffold: false, // Disable all scaffold files
|
|
259
|
-
clientUtils: false, // Disable client utilities
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### Fine-Grained Control
|
|
265
|
-
|
|
266
|
-
Control each file individually:
|
|
267
|
-
|
|
268
|
-
```ts
|
|
269
|
-
export default defineNitroConfig({
|
|
270
|
-
graphql: {
|
|
271
|
-
framework: 'graphql-yoga',
|
|
272
|
-
|
|
273
|
-
// Scaffold files
|
|
274
|
-
scaffold: {
|
|
275
|
-
graphqlConfig: false, // Don't generate graphql.config.ts
|
|
276
|
-
serverSchema: true, // Generate server/graphql/schema.ts
|
|
277
|
-
serverConfig: true, // Generate server/graphql/config.ts
|
|
278
|
-
serverContext: false, // Don't generate server/graphql/context.ts
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
// Client utilities (Nuxt only)
|
|
282
|
-
clientUtils: {
|
|
283
|
-
index: true, // Generate app/graphql/index.ts
|
|
284
|
-
ofetch: false, // Don't generate ofetch wrappers
|
|
285
|
-
},
|
|
286
|
-
|
|
287
|
-
// SDK files
|
|
288
|
-
sdk: {
|
|
289
|
-
main: true, // Generate default SDK
|
|
290
|
-
external: true, // Generate external service SDKs
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
// Type files
|
|
294
|
-
types: {
|
|
295
|
-
server: true, // Generate server types
|
|
296
|
-
client: true, // Generate client types
|
|
297
|
-
external: true, // Generate external service types
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
})
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Custom Paths
|
|
304
|
-
|
|
305
|
-
Customize where files are generated:
|
|
306
|
-
|
|
307
|
-
```ts
|
|
308
|
-
export default defineNitroConfig({
|
|
309
|
-
graphql: {
|
|
310
|
-
framework: 'graphql-yoga',
|
|
311
|
-
|
|
312
|
-
// Method 1: Global paths (affects all files)
|
|
313
|
-
paths: {
|
|
314
|
-
serverGraphql: 'src/server/graphql',
|
|
315
|
-
clientGraphql: 'src/client/graphql',
|
|
316
|
-
buildDir: '.build',
|
|
317
|
-
typesDir: '.build/types',
|
|
318
|
-
},
|
|
319
|
-
|
|
320
|
-
// Method 2: Specific file paths
|
|
321
|
-
scaffold: {
|
|
322
|
-
serverSchema: 'lib/graphql/schema.ts',
|
|
323
|
-
serverConfig: 'lib/graphql/config.ts',
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
sdk: {
|
|
327
|
-
main: 'app/graphql/organization/sdk.ts',
|
|
328
|
-
external: 'app/graphql/{serviceName}/client-sdk.ts',
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
types: {
|
|
332
|
-
server: 'types/graphql-server.d.ts',
|
|
333
|
-
client: 'types/graphql-client.d.ts',
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
})
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Path Placeholders
|
|
340
|
-
|
|
341
|
-
Use placeholders in custom paths:
|
|
342
|
-
|
|
343
|
-
| Placeholder | Description | Example |
|
|
344
|
-
|------------|-------------|---------|
|
|
345
|
-
| `{serviceName}` | External service name | `github`, `stripe` |
|
|
346
|
-
| `{buildDir}` | Build directory | `.nitro` or `.nuxt` |
|
|
347
|
-
| `{rootDir}` | Root directory | `/Users/you/project` |
|
|
348
|
-
| `{framework}` | Framework name | `nuxt` or `nitro` |
|
|
349
|
-
| `{typesDir}` | Types directory | `.nitro/types` |
|
|
350
|
-
| `{serverGraphql}` | Server GraphQL dir | `server/graphql` |
|
|
351
|
-
| `{clientGraphql}` | Client GraphQL dir | `app/graphql` |
|
|
352
|
-
|
|
353
|
-
Example:
|
|
354
|
-
```ts
|
|
355
|
-
sdk: {
|
|
356
|
-
external: '{clientGraphql}/{serviceName}/sdk.ts'
|
|
357
|
-
}
|
|
358
|
-
// → app/graphql/github/sdk.ts
|
|
359
|
-
// → app/graphql/stripe/sdk.ts
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
### Service-Specific Paths
|
|
363
|
-
|
|
364
|
-
Customize paths for individual external services:
|
|
365
|
-
|
|
366
|
-
```ts
|
|
367
|
-
export default defineNuxtConfig({
|
|
368
|
-
nitro: {
|
|
369
|
-
graphql: {
|
|
370
|
-
framework: 'graphql-yoga',
|
|
371
|
-
|
|
372
|
-
// Global default for all external services
|
|
373
|
-
sdk: {
|
|
374
|
-
external: 'app/graphql/{serviceName}/sdk.ts'
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
externalServices: [
|
|
378
|
-
{
|
|
379
|
-
name: 'github',
|
|
380
|
-
endpoint: 'https://api.github.com/graphql',
|
|
381
|
-
schema: 'https://api.github.com/graphql',
|
|
382
|
-
|
|
383
|
-
// GitHub-specific paths (override global config)
|
|
384
|
-
paths: {
|
|
385
|
-
sdk: 'app/graphql/organization/github-sdk.ts',
|
|
386
|
-
types: 'types/github.d.ts',
|
|
387
|
-
ofetch: 'app/graphql/organization/github-client.ts'
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
name: 'stripe',
|
|
392
|
-
endpoint: 'https://api.stripe.com/graphql',
|
|
393
|
-
schema: 'https://api.stripe.com/graphql',
|
|
394
|
-
|
|
395
|
-
// Stripe-specific paths
|
|
396
|
-
paths: {
|
|
397
|
-
sdk: 'app/graphql/payments/stripe-sdk.ts',
|
|
398
|
-
types: 'types/payments/stripe.d.ts',
|
|
399
|
-
// ofetch uses global config
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
name: 'shopify',
|
|
404
|
-
endpoint: 'https://api.shopify.com/graphql',
|
|
405
|
-
// No paths → uses global config
|
|
406
|
-
// → app/graphql/shopify/sdk.ts
|
|
407
|
-
}
|
|
408
|
-
]
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
})
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
### Path Resolution Priority
|
|
415
|
-
|
|
416
|
-
When resolving file paths, the system follows this priority order:
|
|
417
|
-
|
|
418
|
-
1. **Service-specific path** (for external services): `service.paths.sdk`
|
|
419
|
-
2. **Category config**: `sdk.external` or `sdk.main`
|
|
420
|
-
3. **Global paths**: `paths.clientGraphql`
|
|
421
|
-
4. **Framework defaults**: Nuxt vs Nitro defaults
|
|
422
|
-
|
|
423
|
-
Example:
|
|
424
|
-
```ts
|
|
425
|
-
// Given this config:
|
|
426
|
-
{
|
|
427
|
-
paths: { clientGraphql: 'custom/graphql' },
|
|
428
|
-
sdk: { external: '{clientGraphql}/{serviceName}/sdk.ts' },
|
|
429
|
-
externalServices: [
|
|
430
|
-
{
|
|
431
|
-
name: 'github',
|
|
432
|
-
paths: { sdk: 'app/org/github-sdk.ts' } // ← Wins (priority 1)
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
name: 'stripe',
|
|
436
|
-
// Uses sdk.external (priority 2)
|
|
437
|
-
// → custom/graphql/stripe/sdk.ts
|
|
438
|
-
}
|
|
439
|
-
]
|
|
440
|
-
}
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
### Use Cases
|
|
444
|
-
|
|
445
|
-
**Monorepo structure:**
|
|
446
|
-
```ts
|
|
447
|
-
paths: {
|
|
448
|
-
serverGraphql: 'packages/api/src/graphql',
|
|
449
|
-
clientGraphql: 'packages/web/src/graphql',
|
|
450
|
-
typesDir: 'packages/types/src/generated',
|
|
451
|
-
}
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
**Multiple external service organizations:**
|
|
455
|
-
```ts
|
|
456
|
-
externalServices: [
|
|
457
|
-
{
|
|
458
|
-
name: 'github',
|
|
459
|
-
paths: { sdk: 'app/graphql/vcs/github-sdk.ts' }
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
name: 'gitlab',
|
|
463
|
-
paths: { sdk: 'app/graphql/vcs/gitlab-sdk.ts' }
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
name: 'stripe',
|
|
467
|
-
paths: { sdk: 'app/graphql/billing/stripe-sdk.ts' }
|
|
468
|
-
}
|
|
469
|
-
]
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
**Library development (no scaffolding):**
|
|
473
|
-
```ts
|
|
474
|
-
{
|
|
475
|
-
scaffold: false,
|
|
476
|
-
clientUtils: false,
|
|
477
|
-
sdk: { enabled: true }, // Only generate SDKs
|
|
478
|
-
types: { enabled: true }, // Only generate types
|
|
479
|
-
}
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
</details>
|
|
483
|
-
|
|
484
|
-
<details>
|
|
485
|
-
<summary><strong>🎭 Custom Directives</strong></summary>
|
|
486
|
-
|
|
487
|
-
Create reusable GraphQL directives:
|
|
488
|
-
|
|
489
|
-
```ts
|
|
490
|
-
// server/graphql/directives/auth.directive.ts
|
|
491
|
-
export const authDirective = defineDirective({
|
|
492
|
-
name: 'auth',
|
|
493
|
-
locations: ['FIELD_DEFINITION'],
|
|
494
|
-
args: {
|
|
495
|
-
requires: { type: 'String', defaultValue: 'USER' }
|
|
496
|
-
},
|
|
497
|
-
transformer: (schema) => {
|
|
498
|
-
// Add authentication logic
|
|
499
|
-
}
|
|
500
|
-
})
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
Use in schema:
|
|
504
|
-
```graphql
|
|
505
|
-
type Query {
|
|
506
|
-
users: [User!]! @auth(requires: "ADMIN")
|
|
507
|
-
profile: User! @auth
|
|
508
|
-
}
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
</details>
|
|
512
|
-
|
|
513
|
-
<details>
|
|
514
|
-
<summary><strong>🌐 External GraphQL Services</strong></summary>
|
|
515
|
-
|
|
516
|
-
Connect to multiple GraphQL APIs:
|
|
517
|
-
|
|
518
|
-
```ts
|
|
519
|
-
// nuxt.config.ts
|
|
520
|
-
export default defineNuxtConfig({
|
|
521
|
-
nitro: {
|
|
522
|
-
graphql: {
|
|
523
|
-
framework: 'graphql-yoga',
|
|
524
|
-
externalServices: [
|
|
525
|
-
{
|
|
526
|
-
name: 'github',
|
|
527
|
-
schema: 'https://api.github.com/graphql',
|
|
528
|
-
endpoint: 'https://api.github.com/graphql',
|
|
529
|
-
headers: () => ({
|
|
530
|
-
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`
|
|
531
|
-
})
|
|
532
|
-
}
|
|
533
|
-
]
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
})
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
</details>
|
|
540
|
-
|
|
541
|
-
<details>
|
|
542
|
-
<summary><strong>🔄 Apollo Federation</strong></summary>
|
|
543
|
-
|
|
544
|
-
Build federated GraphQL services:
|
|
545
|
-
|
|
546
|
-
```ts
|
|
547
|
-
// nitro.config.ts
|
|
548
|
-
export default defineNitroConfig({
|
|
549
|
-
graphql: {
|
|
550
|
-
framework: 'apollo-server',
|
|
551
|
-
federation: {
|
|
552
|
-
enabled: true,
|
|
553
|
-
serviceName: 'users-service'
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
})
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
</details>
|
|
560
|
-
|
|
561
|
-
## 📖 Documentation
|
|
39
|
+
import { defineConfig } from 'nitro'
|
|
40
|
+
import graphql from 'nitro-graphql'
|
|
562
41
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
| Function | Purpose | Example |
|
|
568
|
-
|----------|---------|---------|
|
|
569
|
-
| `defineResolver` | Complete resolvers | `defineResolver({ Query: {...}, Mutation: {...} })` |
|
|
570
|
-
| `defineQuery` | Query-only resolvers | `defineQuery({ users: () => [...] })` |
|
|
571
|
-
| `defineMutation` | Mutation-only resolvers | `defineMutation({ createUser: (...) => {...} })` |
|
|
572
|
-
| `defineType` | Custom type resolvers | `defineType({ User: { posts: (parent) => [...] } })` |
|
|
573
|
-
| `defineDirective` | Custom directives | `defineDirective({ name: 'auth', ... })` |
|
|
574
|
-
|
|
575
|
-
### Type Generation
|
|
576
|
-
|
|
577
|
-
Automatic TypeScript types are generated:
|
|
578
|
-
- **Server types**: `#graphql/server` - Use in resolvers and server code
|
|
579
|
-
- **Client types**: `#graphql/client` - Use in frontend components
|
|
580
|
-
|
|
581
|
-
```ts
|
|
582
|
-
// Server-side
|
|
583
|
-
import type { User, CreateUserInput } from '#graphql/server'
|
|
584
|
-
|
|
585
|
-
// Client-side
|
|
586
|
-
import type { GetUsersQuery, CreateUserMutation } from '#graphql/client'
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
### Project Structure
|
|
590
|
-
|
|
591
|
-
```
|
|
592
|
-
server/
|
|
593
|
-
├── graphql/
|
|
594
|
-
│ ├── schema.graphql # Main schema
|
|
595
|
-
│ ├── hello.resolver.ts # Basic resolvers
|
|
596
|
-
│ ├── users/
|
|
597
|
-
│ │ ├── user.graphql # User schema
|
|
598
|
-
│ │ └── user.resolver.ts # User resolvers
|
|
599
|
-
│ ├── directives/ # Custom directives
|
|
600
|
-
│ └── config.ts # Optional GraphQL config
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
> **⚠️ Important**: Use **named exports** for all resolvers:
|
|
604
|
-
> ```ts
|
|
605
|
-
> // ✅ Correct
|
|
606
|
-
> export const userQueries = defineQuery({...})
|
|
607
|
-
>
|
|
608
|
-
> // ❌ Deprecated
|
|
609
|
-
> export default defineQuery({...})
|
|
610
|
-
> ```
|
|
611
|
-
|
|
612
|
-
## 🚨 Troubleshooting
|
|
613
|
-
|
|
614
|
-
<details>
|
|
615
|
-
<summary><strong>Common Issues</strong></summary>
|
|
616
|
-
|
|
617
|
-
**GraphQL endpoint returns 404**
|
|
618
|
-
- ✅ Check `nitro-graphql` is in modules
|
|
619
|
-
- ✅ Set `graphql.framework` option
|
|
620
|
-
- ✅ Create at least one `.graphql` file
|
|
621
|
-
|
|
622
|
-
**Types not generating**
|
|
623
|
-
- ✅ Restart dev server
|
|
624
|
-
- ✅ Check file naming: `*.graphql`, `*.resolver.ts`
|
|
625
|
-
- ✅ Verify exports are named exports
|
|
626
|
-
|
|
627
|
-
**Import errors**
|
|
628
|
-
- ✅ Use correct path: `nitro-graphql/utils/define`
|
|
629
|
-
- ✅ Use named exports in resolvers
|
|
630
|
-
|
|
631
|
-
**Vite: "Parse failure: Expected ';', '}' or <eof>" on GraphQL files**
|
|
632
|
-
- ✅ Add `graphql()` plugin from `nitro-graphql/vite`
|
|
633
|
-
- ✅ Ensure `graphql()` is placed **before** `nitro()` in plugins array
|
|
634
|
-
- ✅ Example:
|
|
635
|
-
```ts
|
|
636
|
-
import { graphql } from 'nitro-graphql/vite'
|
|
637
|
-
|
|
638
|
-
export default defineConfig({
|
|
639
|
-
plugins: [
|
|
640
|
-
graphql(), // ← Must be first
|
|
641
|
-
nitro(),
|
|
642
|
-
]
|
|
643
|
-
})
|
|
644
|
-
```
|
|
645
|
-
|
|
646
|
-
**RollupError: "[exportName]" is not exported by "[file].resolver.ts"**
|
|
647
|
-
|
|
648
|
-
This error occurs when the resolver scanner can't find the expected export in your resolver file. Common causes:
|
|
649
|
-
|
|
650
|
-
1. **Using default export instead of named export** ❌
|
|
651
|
-
```ts
|
|
652
|
-
// ❌ WRONG - Will not be detected
|
|
653
|
-
export default defineQuery({
|
|
654
|
-
users: () => [...]
|
|
655
|
-
})
|
|
656
|
-
```
|
|
657
|
-
|
|
658
|
-
```ts
|
|
659
|
-
// ✅ CORRECT - Use named export
|
|
660
|
-
export const userQueries = defineQuery({
|
|
661
|
-
users: () => [...]
|
|
662
|
-
})
|
|
663
|
-
```
|
|
664
|
-
|
|
665
|
-
2. **Not using a define function** ❌
|
|
666
|
-
```ts
|
|
667
|
-
// ❌ WRONG - Plain object won't be detected
|
|
668
|
-
export const resolvers = {
|
|
669
|
-
Query: {
|
|
670
|
-
users: () => [...]
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
```
|
|
674
|
-
|
|
675
|
-
```ts
|
|
676
|
-
// ✅ CORRECT - Use defineResolver, defineQuery, etc.
|
|
677
|
-
export const userResolver = defineResolver({
|
|
678
|
-
Query: {
|
|
679
|
-
users: () => [...]
|
|
680
|
-
}
|
|
681
|
-
})
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
3. **File naming doesn't match export** ❌
|
|
685
|
-
```ts
|
|
686
|
-
// ❌ File: uploadFile.resolver.ts but export is named differently
|
|
687
|
-
export const fileUploader = defineMutation({...})
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
```ts
|
|
691
|
-
// ✅ CORRECT - Export name can be anything, as long as it uses a define function
|
|
692
|
-
export const uploadFile = defineMutation({...})
|
|
693
|
-
export const fileUploader = defineMutation({...}) // Both work!
|
|
694
|
-
```
|
|
695
|
-
|
|
696
|
-
4. **Syntax errors preventing parsing**
|
|
697
|
-
- Check for TypeScript compilation errors in the file
|
|
698
|
-
- Ensure imports are valid
|
|
699
|
-
- Verify no missing brackets or syntax issues
|
|
700
|
-
|
|
701
|
-
**How resolver scanning works:**
|
|
702
|
-
- The module uses `oxc-parser` to scan `.resolver.ts` files
|
|
703
|
-
- It looks for **named exports** using these functions:
|
|
704
|
-
- `defineResolver` - Complete resolver with Query, Mutation, etc.
|
|
705
|
-
- `defineQuery` - Query-only resolvers
|
|
706
|
-
- `defineMutation` - Mutation-only resolvers
|
|
707
|
-
- `defineType` - Custom type resolvers
|
|
708
|
-
- `defineSubscription` - Subscription resolvers
|
|
709
|
-
- `defineDirective` - Directive resolvers
|
|
710
|
-
- Only exports using these functions are included in the virtual module
|
|
711
|
-
|
|
712
|
-
**Debugging steps:**
|
|
713
|
-
1. Check your resolver file uses named exports: `export const name = defineQuery({...})`
|
|
714
|
-
2. Verify you're using one of the define functions listed above
|
|
715
|
-
3. Look for TypeScript/syntax errors in the file
|
|
716
|
-
4. Restart the dev server after fixing
|
|
717
|
-
5. If issues persist, simplify the resolver to test (single query)
|
|
718
|
-
|
|
719
|
-
</details>
|
|
720
|
-
|
|
721
|
-
## 🌟 Production Usage
|
|
722
|
-
|
|
723
|
-
This package powers production applications:
|
|
724
|
-
|
|
725
|
-
- [**Nitroping**](https://github.com/productdevbook/nitroping) - Self-hosted push notification service
|
|
726
|
-
|
|
727
|
-
## 🤖 Using Claude Code
|
|
728
|
-
|
|
729
|
-
Speed up development with [Claude Code](https://claude.ai/code) — AI-powered assistance for setting up and building with nitro-graphql.
|
|
730
|
-
|
|
731
|
-
### Quick Setup Prompts
|
|
732
|
-
|
|
733
|
-
Copy and paste these prompts into Claude Code to scaffold a complete GraphQL API.
|
|
734
|
-
|
|
735
|
-
**💡 Tip**: After pasting, Claude Code will execute step-by-step and validate each action.
|
|
736
|
-
|
|
737
|
-
<details>
|
|
738
|
-
<summary>🟢 <strong>Nuxt Project</strong></summary>
|
|
739
|
-
|
|
740
|
-
```
|
|
741
|
-
## GOAL
|
|
742
|
-
Set up nitro-graphql in this Nuxt project with a User management GraphQL API.
|
|
743
|
-
|
|
744
|
-
## PREREQUISITES
|
|
745
|
-
Check if this is a Nuxt project by looking for nuxt.config.ts in the root.
|
|
746
|
-
|
|
747
|
-
## STEP 1: INSTALL DEPENDENCIES
|
|
748
|
-
Action: Run this command
|
|
749
|
-
Command: pnpm add nitro-graphql graphql-yoga graphql
|
|
750
|
-
Validation: Check package.json contains these packages
|
|
751
|
-
|
|
752
|
-
## STEP 2: CONFIGURE NUXT
|
|
753
|
-
File: nuxt.config.ts
|
|
754
|
-
Action: EDIT (add to existing config, don't replace)
|
|
755
|
-
Add these properties:
|
|
756
|
-
|
|
757
|
-
export default defineNuxtConfig({
|
|
758
|
-
modules: ['nitro-graphql/nuxt'], // Add this module
|
|
759
|
-
nitro: {
|
|
760
|
-
graphql: {
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
serverDir: './',
|
|
44
|
+
modules: [
|
|
45
|
+
graphql({
|
|
761
46
|
framework: 'graphql-yoga',
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
Validation: Check the file has modules array and nitro.graphql config
|
|
767
|
-
|
|
768
|
-
## STEP 3: CREATE SCHEMA
|
|
769
|
-
File: server/graphql/schema.graphql
|
|
770
|
-
Action: CREATE NEW FILE (create server/graphql/ directory if needed)
|
|
771
|
-
Content:
|
|
772
|
-
|
|
773
|
-
type User {
|
|
774
|
-
id: ID!
|
|
775
|
-
name: String!
|
|
776
|
-
email: String!
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
type Query {
|
|
780
|
-
users: [User!]!
|
|
781
|
-
user(id: ID!): User
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
type Mutation {
|
|
785
|
-
_empty: String
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
Validation: File should be in server/graphql/ directory
|
|
789
|
-
|
|
790
|
-
## STEP 4: CREATE CONTEXT (Optional but recommended)
|
|
791
|
-
File: server/graphql/context.ts
|
|
792
|
-
Action: CREATE NEW FILE (auto-generated on first run, but create manually for clarity)
|
|
793
|
-
Content:
|
|
794
|
-
|
|
795
|
-
// Extend H3 event context with custom properties
|
|
796
|
-
declare module 'h3' {
|
|
797
|
-
interface H3EventContext {
|
|
798
|
-
// Add your custom context properties here
|
|
799
|
-
// Example:
|
|
800
|
-
// db?: Database
|
|
801
|
-
// auth?: { userId: string }
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
Note: This file lets you add custom properties to resolver context
|
|
806
|
-
Validation: File exists in server/graphql/
|
|
807
|
-
|
|
808
|
-
## STEP 5: CREATE CONFIG (Optional)
|
|
809
|
-
File: server/graphql/config.ts
|
|
810
|
-
Action: CREATE NEW FILE (auto-generated, customize if needed)
|
|
811
|
-
Content:
|
|
812
|
-
|
|
813
|
-
// Custom GraphQL Yoga configuration
|
|
814
|
-
export default defineGraphQLConfig({
|
|
815
|
-
// Custom context enhancer, plugins, etc.
|
|
816
|
-
// See: https://the-guild.dev/graphql/yoga-server/docs
|
|
817
|
-
})
|
|
818
|
-
|
|
819
|
-
Note: Use this to customize GraphQL Yoga options
|
|
820
|
-
Validation: File exists in server/graphql/
|
|
821
|
-
|
|
822
|
-
## STEP 6: CREATE RESOLVERS
|
|
823
|
-
File: server/graphql/users.resolver.ts
|
|
824
|
-
Action: CREATE NEW FILE
|
|
825
|
-
Content:
|
|
826
|
-
|
|
827
|
-
// ⚠️ CRITICAL: Use NAMED EXPORTS (not default export)
|
|
828
|
-
export const userQueries = defineQuery({
|
|
829
|
-
users: async (_, __, context) => {
|
|
830
|
-
// context is H3EventContext - access event, storage, etc.
|
|
831
|
-
return [
|
|
832
|
-
{ id: '1', name: 'John Doe', email: 'john@example.com' },
|
|
833
|
-
{ id: '2', name: 'Jane Smith', email: 'jane@example.com' }
|
|
834
|
-
]
|
|
835
|
-
},
|
|
836
|
-
user: async (_, { id }, context) => {
|
|
837
|
-
// Third parameter is context (H3EventContext)
|
|
838
|
-
const users = [
|
|
839
|
-
{ id: '1', name: 'John Doe', email: 'john@example.com' },
|
|
840
|
-
{ id: '2', name: 'Jane Smith', email: 'jane@example.com' }
|
|
841
|
-
]
|
|
842
|
-
return users.find(u => u.id === id) || null
|
|
843
|
-
}
|
|
844
|
-
})
|
|
845
|
-
|
|
846
|
-
Validation: File ends with .resolver.ts and uses named export
|
|
847
|
-
|
|
848
|
-
## STEP 7: START DEV SERVER
|
|
849
|
-
Command: pnpm dev
|
|
850
|
-
Expected Output: Server starts on http://localhost:3000
|
|
851
|
-
Wait for: "Nitro built in X ms" message
|
|
852
|
-
Note: context.ts and config.ts will auto-generate if you skipped steps 4-5
|
|
853
|
-
|
|
854
|
-
## VALIDATION CHECKLIST
|
|
855
|
-
- [ ] Navigate to http://localhost:3000/api/graphql - should show GraphQL playground
|
|
856
|
-
- [ ] Health check: http://localhost:3000/api/graphql/health - should return OK
|
|
857
|
-
- [ ] Run this query in playground:
|
|
858
|
-
```graphql
|
|
859
|
-
query {
|
|
860
|
-
users {
|
|
861
|
-
id
|
|
862
|
-
name
|
|
863
|
-
email
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
```
|
|
867
|
-
Expected: Returns 2 users
|
|
868
|
-
- [ ] Check .nuxt/types/nitro-graphql-server.d.ts exists (types auto-generated)
|
|
869
|
-
|
|
870
|
-
## FILE STRUCTURE CREATED
|
|
871
|
-
```
|
|
872
|
-
server/
|
|
873
|
-
graphql/
|
|
874
|
-
schema.graphql ← GraphQL type definitions
|
|
875
|
-
context.ts ← H3 event context augmentation (optional)
|
|
876
|
-
config.ts ← GraphQL Yoga config (optional)
|
|
877
|
-
users.resolver.ts ← Query resolvers
|
|
878
|
-
.nuxt/
|
|
879
|
-
types/
|
|
880
|
-
nitro-graphql-server.d.ts ← Auto-generated types
|
|
881
|
-
graphql.config.ts ← Auto-generated (for IDE tooling)
|
|
882
|
-
```
|
|
883
|
-
|
|
884
|
-
## CRITICAL RULES (MUST FOLLOW)
|
|
885
|
-
❌ DO NOT use default exports in resolvers
|
|
886
|
-
Wrong: export default defineQuery({...})
|
|
887
|
-
Right: export const userQueries = defineQuery({...})
|
|
888
|
-
|
|
889
|
-
❌ DO NOT name files without .resolver.ts extension
|
|
890
|
-
Wrong: users.ts or user-resolver.ts
|
|
891
|
-
Right: users.resolver.ts or user.resolver.ts
|
|
892
|
-
|
|
893
|
-
✅ DO use named exports for all resolvers
|
|
894
|
-
✅ DO place files in server/graphql/ directory
|
|
895
|
-
✅ DO restart dev server if types don't generate
|
|
896
|
-
|
|
897
|
-
## TROUBLESHOOTING
|
|
898
|
-
Issue: "GraphQL endpoint returns 404"
|
|
899
|
-
Fix: Ensure 'nitro-graphql/nuxt' is in modules array (not just 'nitro-graphql')
|
|
900
|
-
|
|
901
|
-
Issue: "defineQuery is not defined"
|
|
902
|
-
Fix: Restart dev server - auto-imports need to regenerate
|
|
903
|
-
|
|
904
|
-
Issue: "Types not generating"
|
|
905
|
-
Fix: Check .nuxt/types/nitro-graphql-server.d.ts exists, if not restart dev server
|
|
906
|
-
|
|
907
|
-
Issue: "Module not found: nitro-graphql"
|
|
908
|
-
Fix: Run pnpm install again, check package.json has the package
|
|
909
|
-
|
|
910
|
-
## NEXT STEPS (After Setup Works)
|
|
911
|
-
1. Add mutations: "Add createUser and deleteUser mutations with H3 storage"
|
|
912
|
-
2. Extend context: "Add database connection to context.ts and use it in resolvers"
|
|
913
|
-
3. Use types: "Import and use TypeScript types from #graphql/server in resolvers"
|
|
914
|
-
4. Add auth: "Add authentication middleware using context in resolvers"
|
|
915
|
-
5. Custom config: "Configure GraphQL Yoga plugins in config.ts"
|
|
916
|
-
|
|
917
|
-
Now implement this setup step-by-step.
|
|
918
|
-
```
|
|
919
|
-
|
|
920
|
-
</details>
|
|
921
|
-
|
|
922
|
-
<details>
|
|
923
|
-
<summary>⚡ <strong>Nitro Project</strong></summary>
|
|
924
|
-
|
|
925
|
-
```
|
|
926
|
-
Set up nitro-graphql in this Nitro project following these exact specifications:
|
|
927
|
-
|
|
928
|
-
INSTALLATION:
|
|
929
|
-
1. Run: pnpm add nitro-graphql graphql-yoga graphql
|
|
930
|
-
|
|
931
|
-
CONFIGURATION (nitro.config.ts):
|
|
932
|
-
import { defineNitroConfig } from 'nitro/config'
|
|
933
|
-
|
|
934
|
-
export default defineNitroConfig({
|
|
935
|
-
modules: ['nitro-graphql'],
|
|
936
|
-
graphql: {
|
|
937
|
-
framework: 'graphql-yoga',
|
|
938
|
-
},
|
|
939
|
-
})
|
|
940
|
-
|
|
941
|
-
SCHEMA (server/graphql/schema.graphql):
|
|
942
|
-
type Product {
|
|
943
|
-
id: ID!
|
|
944
|
-
name: String!
|
|
945
|
-
price: Float!
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
input CreateProductInput {
|
|
949
|
-
name: String!
|
|
950
|
-
price: Float!
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
type Query {
|
|
954
|
-
products: [Product!]!
|
|
955
|
-
product(id: ID!): Product
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
type Mutation {
|
|
959
|
-
createProduct(input: CreateProductInput!): Product!
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
RESOLVERS (server/graphql/products.resolver.ts):
|
|
963
|
-
// Use NAMED EXPORTS only
|
|
964
|
-
export const productQueries = defineQuery({
|
|
965
|
-
products: async (_, __, context) => {
|
|
966
|
-
// Access H3 event context
|
|
967
|
-
const products = await context.storage?.getItem('products') || []
|
|
968
|
-
return products
|
|
969
|
-
},
|
|
970
|
-
product: async (_, { id }, context) => {
|
|
971
|
-
const products = await context.storage?.getItem('products') || []
|
|
972
|
-
return products.find(p => p.id === id)
|
|
973
|
-
}
|
|
974
|
-
})
|
|
975
|
-
|
|
976
|
-
export const productMutations = defineMutation({
|
|
977
|
-
createProduct: async (_, { input }, context) => {
|
|
978
|
-
const products = await context.storage?.getItem('products') || []
|
|
979
|
-
const product = {
|
|
980
|
-
id: Date.now().toString(),
|
|
981
|
-
...input
|
|
982
|
-
}
|
|
983
|
-
products.push(product)
|
|
984
|
-
await context.storage?.setItem('products', products)
|
|
985
|
-
return product
|
|
986
|
-
}
|
|
987
|
-
})
|
|
988
|
-
|
|
989
|
-
KEY RULES:
|
|
990
|
-
- Files: *.graphql for schemas, *.resolver.ts for resolvers
|
|
991
|
-
- MUST use named exports (not default export)
|
|
992
|
-
- defineQuery and defineMutation are auto-imported
|
|
993
|
-
- Context is the third parameter (access H3 event context)
|
|
994
|
-
- Endpoint: http://localhost:3000/api/graphql
|
|
995
|
-
|
|
996
|
-
Now implement this setup.
|
|
997
|
-
```
|
|
998
|
-
|
|
999
|
-
</details>
|
|
1000
|
-
|
|
1001
|
-
<details>
|
|
1002
|
-
<summary>🎮 <strong>Apollo Server Setup</strong></summary>
|
|
1003
|
-
|
|
1004
|
-
```
|
|
1005
|
-
Set up nitro-graphql with Apollo Server following these exact specifications:
|
|
1006
|
-
|
|
1007
|
-
INSTALLATION:
|
|
1008
|
-
1. Run: pnpm add nitro-graphql @apollo/server @apollo/utils.withrequired @as-integrations/h3 graphql
|
|
1009
|
-
|
|
1010
|
-
CONFIGURATION (nitro.config.ts):
|
|
1011
|
-
import { defineNitroConfig } from 'nitro/config'
|
|
1012
|
-
|
|
1013
|
-
export default defineNitroConfig({
|
|
1014
|
-
modules: ['nitro-graphql'],
|
|
1015
|
-
graphql: {
|
|
1016
|
-
framework: 'apollo-server',
|
|
1017
|
-
},
|
|
1018
|
-
})
|
|
1019
|
-
|
|
1020
|
-
SCHEMA (server/graphql/schema.graphql):
|
|
1021
|
-
type Book {
|
|
1022
|
-
id: ID!
|
|
1023
|
-
title: String!
|
|
1024
|
-
author: String!
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
type Query {
|
|
1028
|
-
books: [Book!]!
|
|
1029
|
-
book(id: ID!): Book
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
type Mutation {
|
|
1033
|
-
addBook(title: String!, author: String!): Book!
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
RESOLVERS (server/graphql/books.resolver.ts):
|
|
1037
|
-
// IMPORTANT: Use NAMED EXPORTS
|
|
1038
|
-
export const bookResolver = defineResolver({
|
|
1039
|
-
Query: {
|
|
1040
|
-
books: async () => {
|
|
1041
|
-
return [
|
|
1042
|
-
{ id: '1', title: '1984', author: 'George Orwell' }
|
|
1043
|
-
]
|
|
1044
|
-
},
|
|
1045
|
-
book: async (_, { id }) => {
|
|
1046
|
-
return { id, title: '1984', author: 'George Orwell' }
|
|
1047
|
-
}
|
|
1048
|
-
},
|
|
1049
|
-
Mutation: {
|
|
1050
|
-
addBook: async (_, { title, author }) => {
|
|
1051
|
-
return {
|
|
1052
|
-
id: Date.now().toString(),
|
|
1053
|
-
title,
|
|
1054
|
-
author
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
})
|
|
1059
|
-
|
|
1060
|
-
KEY RULES:
|
|
1061
|
-
- framework: 'apollo-server' in config
|
|
1062
|
-
- defineResolver for complete resolver maps
|
|
1063
|
-
- Named exports required (export const name = ...)
|
|
1064
|
-
- Apollo Sandbox: http://localhost:3000/api/graphql
|
|
1065
|
-
- Supports Apollo Federation with federation: { enabled: true }
|
|
1066
|
-
|
|
1067
|
-
Now implement this setup.
|
|
1068
|
-
```
|
|
1069
|
-
|
|
1070
|
-
</details>
|
|
1071
|
-
|
|
1072
|
-
<details>
|
|
1073
|
-
<summary>🔄 <strong>Add Feature to Existing Setup</strong></summary>
|
|
1074
|
-
|
|
1075
|
-
```
|
|
1076
|
-
Add a complete blog posts feature to my nitro-graphql API following these specifications:
|
|
1077
|
-
|
|
1078
|
-
SCHEMA (server/graphql/posts/post.graphql):
|
|
1079
|
-
type Post {
|
|
1080
|
-
id: ID!
|
|
1081
|
-
title: String!
|
|
1082
|
-
content: String!
|
|
1083
|
-
authorId: ID!
|
|
1084
|
-
createdAt: String!
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
input CreatePostInput {
|
|
1088
|
-
title: String!
|
|
1089
|
-
content: String!
|
|
1090
|
-
authorId: ID!
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
input UpdatePostInput {
|
|
1094
|
-
title: String
|
|
1095
|
-
content: String
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
extend type Query {
|
|
1099
|
-
posts(limit: Int = 10, offset: Int = 0): [Post!]!
|
|
1100
|
-
post(id: ID!): Post
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
extend type Mutation {
|
|
1104
|
-
createPost(input: CreatePostInput!): Post!
|
|
1105
|
-
updatePost(id: ID!, input: UpdatePostInput!): Post
|
|
1106
|
-
deletePost(id: ID!): Boolean!
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
RESOLVERS (server/graphql/posts/post.resolver.ts):
|
|
1110
|
-
// Use NAMED EXPORTS
|
|
1111
|
-
export const postQueries = defineQuery({
|
|
1112
|
-
posts: async (_, { limit, offset }, context) => {
|
|
1113
|
-
const posts = await context.storage?.getItem('posts') || []
|
|
1114
|
-
return posts.slice(offset, offset + limit)
|
|
1115
|
-
},
|
|
1116
|
-
post: async (_, { id }, context) => {
|
|
1117
|
-
const posts = await context.storage?.getItem('posts') || []
|
|
1118
|
-
return posts.find(p => p.id === id) || null
|
|
1119
|
-
}
|
|
1120
|
-
})
|
|
1121
|
-
|
|
1122
|
-
export const postMutations = defineMutation({
|
|
1123
|
-
createPost: async (_, { input }, context) => {
|
|
1124
|
-
const posts = await context.storage?.getItem('posts') || []
|
|
1125
|
-
const post = {
|
|
1126
|
-
id: Date.now().toString(),
|
|
1127
|
-
...input,
|
|
1128
|
-
createdAt: new Date().toISOString()
|
|
1129
|
-
}
|
|
1130
|
-
posts.push(post)
|
|
1131
|
-
await context.storage?.setItem('posts', posts)
|
|
1132
|
-
return post
|
|
1133
|
-
},
|
|
1134
|
-
updatePost: async (_, { id, input }, context) => {
|
|
1135
|
-
const posts = await context.storage?.getItem('posts') || []
|
|
1136
|
-
const index = posts.findIndex(p => p.id === id)
|
|
1137
|
-
if (index === -1) return null
|
|
1138
|
-
posts[index] = { ...posts[index], ...input }
|
|
1139
|
-
await context.storage?.setItem('posts', posts)
|
|
1140
|
-
return posts[index]
|
|
1141
|
-
},
|
|
1142
|
-
deletePost: async (_, { id }, context) => {
|
|
1143
|
-
const posts = await context.storage?.getItem('posts') || []
|
|
1144
|
-
const filtered = posts.filter(p => p.id !== id)
|
|
1145
|
-
await context.storage?.setItem('posts', filtered)
|
|
1146
|
-
return filtered.length < posts.length
|
|
1147
|
-
}
|
|
47
|
+
serverDir: './',
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
1148
50
|
})
|
|
1149
|
-
|
|
1150
|
-
TYPE USAGE:
|
|
1151
|
-
After dev server restarts, types are auto-generated in:
|
|
1152
|
-
- .nitro/types/nitro-graphql-server.d.ts (server types)
|
|
1153
|
-
- .nuxt/types/nitro-graphql-server.d.ts (for Nuxt)
|
|
1154
|
-
|
|
1155
|
-
Import types:
|
|
1156
|
-
import type { Post, CreatePostInput } from '#graphql/server'
|
|
1157
|
-
|
|
1158
|
-
KEY RULES:
|
|
1159
|
-
- Use "extend type" to add to existing Query/Mutation
|
|
1160
|
-
- Named exports required
|
|
1161
|
-
- Context has H3 event properties
|
|
1162
|
-
- Types auto-generate on file changes
|
|
1163
|
-
|
|
1164
|
-
Now implement this feature.
|
|
1165
|
-
```
|
|
1166
|
-
|
|
1167
|
-
</details>
|
|
1168
|
-
|
|
1169
|
-
### Working with Your GraphQL API
|
|
1170
|
-
|
|
1171
|
-
Once set up, you can ask Claude Code for help with:
|
|
1172
|
-
|
|
1173
|
-
```
|
|
1174
|
-
"Add authentication to my GraphQL resolvers"
|
|
1175
|
-
"Create a custom @auth directive for field-level permissions"
|
|
1176
|
-
"Set up type generation for client-side queries"
|
|
1177
|
-
"Add pagination to my users query"
|
|
1178
|
-
"Connect to an external GitHub GraphQL API"
|
|
1179
|
-
"Debug: my types aren't generating in .nitro/types/"
|
|
1180
|
-
"Optimize resolver performance using DataLoader"
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
### Tips for Better Results
|
|
1184
|
-
|
|
1185
|
-
- **Start specific**: Include your framework (Nuxt/Nitro), version, and goal
|
|
1186
|
-
- **Reference docs**: Mention "following nitro-graphql conventions" to align with best practices
|
|
1187
|
-
- **Show errors**: Paste error messages for faster debugging
|
|
1188
|
-
- **Test iteratively**: Run `pnpm dev` after each change to verify
|
|
1189
|
-
|
|
1190
|
-
## 🛠️ Development
|
|
1191
|
-
|
|
1192
|
-
```bash
|
|
1193
|
-
# Install dependencies
|
|
1194
|
-
pnpm install
|
|
1195
|
-
|
|
1196
|
-
# Build module
|
|
1197
|
-
pnpm build
|
|
1198
|
-
|
|
1199
|
-
# Watch mode
|
|
1200
|
-
pnpm dev
|
|
1201
|
-
|
|
1202
|
-
# Run playgrounds
|
|
1203
|
-
pnpm playground:nitro
|
|
1204
|
-
pnpm playground:nuxt
|
|
1205
|
-
pnpm playground:federation
|
|
1206
|
-
|
|
1207
|
-
# Lint
|
|
1208
|
-
pnpm lint
|
|
1209
51
|
```
|
|
1210
52
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
> [!TIP]
|
|
1214
|
-
> **Want to contribute?** We believe you can play a role in the growth of this project!
|
|
53
|
+
See the [documentation](https://nitro-graphql.pages.dev) for Nuxt and Vite setup.
|
|
1215
54
|
|
|
1216
|
-
|
|
1217
|
-
- 💡 **Share ideas** via [GitHub Issues](https://github.com/productdevbook/nitro-graphql/issues)
|
|
1218
|
-
- 🐛 **Report bugs** with detailed information
|
|
1219
|
-
- 📖 **Improve docs** - README, examples, guides
|
|
1220
|
-
- 🔧 **Code contributions** - Bug fixes and features
|
|
1221
|
-
- 🌟 **Star the project** to show support
|
|
55
|
+
## Resources
|
|
1222
56
|
|
|
1223
|
-
|
|
1224
|
-
- [
|
|
1225
|
-
- [
|
|
1226
|
-
- [ ]
|
|
1227
|
-
- [ ] VS Code extension
|
|
57
|
+
- [Documentation](https://nitro-graphql.pages.dev)
|
|
58
|
+
- [Examples](./examples/) - Real-world integrations (Drizzle ORM, etc.)
|
|
59
|
+
- [Playgrounds](./playgrounds/) - Development environments
|
|
60
|
+
- [GitHub Issues](https://github.com/productdevbook/nitro-graphql/issues)
|
|
1228
61
|
|
|
1229
62
|
## Sponsors
|
|
1230
63
|
|
|
@@ -1243,9 +76,11 @@ pnpm lint
|
|
|
1243
76
|
[npm-version-href]: https://npmjs.com/package/nitro-graphql
|
|
1244
77
|
[npm-downloads-src]: https://img.shields.io/npm/dm/nitro-graphql?style=flat&colorA=080f12&colorB=1fa669
|
|
1245
78
|
[npm-downloads-href]: https://npmjs.com/package/nitro-graphql
|
|
1246
|
-
[bundle-src]: https://deno.bundlejs.com/badge?q=nitro-graphql@0.0.4
|
|
1247
|
-
[bundle-href]: https://deno.bundlejs.com/badge?q=nitro-graphql@0.0.4
|
|
1248
79
|
[license-src]: https://img.shields.io/github/license/productdevbook/nitro-graphql.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
1249
80
|
[license-href]: https://github.com/productdevbook/nitro-graphql/blob/main/LICENSE
|
|
1250
81
|
[docs-src]: https://img.shields.io/badge/docs-read-blue?style=flat&colorA=080f12&colorB=1fa669
|
|
1251
|
-
[docs-href]: https://nitro-graphql.pages.dev
|
|
82
|
+
[docs-href]: https://nitro-graphql.pages.dev
|
|
83
|
+
[beta-src]: https://img.shields.io/npm/v/nitro-graphql/beta?style=flat&logo=rocket&logoColor=white&label=beta&color=7c3aed&colorA=080f12
|
|
84
|
+
[beta-href]: https://github.com/productdevbook/nitro-graphql/releases
|
|
85
|
+
[coverage-src]: https://img.shields.io/badge/coverage-66%25-green?style=flat&colorA=080f12
|
|
86
|
+
[coverage-href]: https://github.com/productdevbook/nitro-graphql/actions/workflows/ci.yml
|