nuxt-openapi-hyperfetch 0.3.81-beta → 1.0.0

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.
Files changed (64) hide show
  1. package/README.md +218 -212
  2. package/dist/generators/components/connector-generator/templates.js +67 -17
  3. package/dist/generators/components/schema-analyzer/intent-detector.js +1 -12
  4. package/dist/generators/components/schema-analyzer/openapi-reader.js +10 -1
  5. package/dist/generators/components/schema-analyzer/resource-grouper.js +7 -0
  6. package/dist/generators/components/schema-analyzer/schema-field-mapper.js +1 -22
  7. package/dist/generators/components/schema-analyzer/types.d.ts +10 -0
  8. package/dist/generators/connectors/generator.d.ts +12 -0
  9. package/dist/generators/connectors/generator.js +115 -0
  10. package/dist/generators/connectors/runtime/connector-types.d.ts +147 -0
  11. package/dist/generators/connectors/runtime/connector-types.js +10 -0
  12. package/dist/generators/connectors/runtime/useCreateConnector.d.ts +26 -0
  13. package/dist/generators/connectors/runtime/useCreateConnector.js +156 -0
  14. package/dist/generators/connectors/runtime/useDeleteConnector.d.ts +30 -0
  15. package/dist/generators/connectors/runtime/useDeleteConnector.js +143 -0
  16. package/dist/generators/connectors/runtime/useGetAllConnector.d.ts +25 -0
  17. package/dist/generators/connectors/runtime/useGetAllConnector.js +127 -0
  18. package/dist/generators/connectors/runtime/useGetConnector.d.ts +15 -0
  19. package/dist/generators/connectors/runtime/useGetConnector.js +99 -0
  20. package/dist/generators/connectors/runtime/useUpdateConnector.d.ts +34 -0
  21. package/dist/generators/connectors/runtime/useUpdateConnector.js +211 -0
  22. package/dist/generators/connectors/runtime/zod-error-merger.d.ts +23 -0
  23. package/dist/generators/connectors/runtime/zod-error-merger.js +106 -0
  24. package/dist/generators/connectors/templates.d.ts +4 -0
  25. package/dist/generators/connectors/templates.js +376 -0
  26. package/dist/generators/connectors/types.d.ts +37 -0
  27. package/dist/generators/connectors/types.js +7 -0
  28. package/dist/generators/shared/runtime/useDeleteConnector.js +4 -2
  29. package/dist/generators/shared/runtime/useDetailConnector.d.ts +0 -1
  30. package/dist/generators/shared/runtime/useDetailConnector.js +9 -20
  31. package/dist/generators/shared/runtime/useFormConnector.js +4 -3
  32. package/dist/generators/use-async-data/runtime/useApiAsyncData.js +14 -5
  33. package/dist/generators/use-async-data/templates.js +20 -16
  34. package/dist/generators/use-fetch/templates.js +1 -1
  35. package/dist/index.js +1 -16
  36. package/dist/module/index.js +2 -3
  37. package/package.json +4 -3
  38. package/src/cli/prompts.ts +1 -7
  39. package/src/generators/components/connector-generator/templates.ts +97 -22
  40. package/src/generators/components/schema-analyzer/intent-detector.ts +1 -16
  41. package/src/generators/components/schema-analyzer/openapi-reader.ts +14 -1
  42. package/src/generators/components/schema-analyzer/resource-grouper.ts +9 -0
  43. package/src/generators/components/schema-analyzer/schema-field-mapper.ts +1 -26
  44. package/src/generators/components/schema-analyzer/types.ts +11 -0
  45. package/src/generators/connectors/generator.ts +137 -0
  46. package/src/generators/connectors/runtime/connector-types.ts +207 -0
  47. package/src/generators/connectors/runtime/useCreateConnector.ts +199 -0
  48. package/src/generators/connectors/runtime/useDeleteConnector.ts +179 -0
  49. package/src/generators/connectors/runtime/useGetAllConnector.ts +151 -0
  50. package/src/generators/connectors/runtime/useGetConnector.ts +120 -0
  51. package/src/generators/connectors/runtime/useUpdateConnector.ts +257 -0
  52. package/src/generators/connectors/runtime/zod-error-merger.ts +119 -0
  53. package/src/generators/connectors/templates.ts +481 -0
  54. package/src/generators/connectors/types.ts +39 -0
  55. package/src/generators/shared/runtime/useDeleteConnector.ts +4 -2
  56. package/src/generators/shared/runtime/useDetailConnector.ts +8 -19
  57. package/src/generators/shared/runtime/useFormConnector.ts +4 -3
  58. package/src/generators/use-async-data/runtime/useApiAsyncData.ts +16 -5
  59. package/src/generators/use-async-data/templates.ts +24 -16
  60. package/src/generators/use-fetch/templates.ts +1 -1
  61. package/src/index.ts +2 -19
  62. package/src/module/index.ts +2 -5
  63. package/docs/generated-components.md +0 -615
  64. package/docs/headless-composables-ui.md +0 -569
package/README.md CHANGED
@@ -1,309 +1,315 @@
1
1
  <p align="center">
2
- <img src="./public/nuxt-openapi-hyperfetch-logo.png" alt="Nuxt OpenAPI Hyperfetch logo" width="260" />
2
+ <img src="https://raw.githubusercontent.com/dmartindiaz/nuxt-openapi-hyperfetch/main/public/nuxt-openapi-hyperfetch-logo.png" alt="Nuxt OpenAPI Hyperfetch logo" width="260" />
3
3
  </p>
4
4
 
5
- # 🚀 Nuxt OpenAPI Generator
6
-
7
- **Generate type-safe, SSR-compatible Nuxt composables from OpenAPI/Swagger specifications.**
5
+ <p align="center">
6
+ <strong>Generate type-safe CRUD composables from your OpenAPI spec.</strong><br/>
7
+ One command. Full TypeScript. SSR-ready.
8
+ </p>
8
9
 
9
- 📖 **[Full documentation → nuxt-openapi-hyperfetch.netlify.app](https://nuxt-openapi-hyperfetch.netlify.app/)**
10
+ <p align="center">
11
+ <a href="https://nuxt-openapi-hyperfetch.netlify.app/">📖 Documentation</a> ·
12
+ <a href="#connectors">Connectors</a> ·
13
+ <a href="#installation">Installation</a> ·
14
+ <a href="#quick-start">Quick Start</a>
15
+ </p>
10
16
 
11
17
  ---
12
18
 
13
- Transform your API documentation into production-ready **100% Nuxt-native** code—`useFetch` composables, `useAsyncData` composables, and Nuxt Server Routes—with full TypeScript support, lifecycle callbacks, and request interception. Use it either as a CLI with `nxh generate` or as a Nuxt module wired directly from `nuxt.config.ts`.
14
-
15
- ---
19
+ ## Installation
16
20
 
17
- ## ✨ Features
21
+ ```bash
22
+ # Global CLI
23
+ npm install -g nuxt-openapi-hyperfetch
18
24
 
19
- - 🔒 **Type-Safe**: Full TypeScript support derived from your OpenAPI schema
20
- - **SSR Compatible**: Works seamlessly with Nuxt server-side rendering
21
- - 🔄 **Lifecycle Callbacks**: `onRequest`, `onSuccess`, `onError`, `onFinish`
22
- - 🌐 **Global Callbacks Plugin**: Define callbacks once, apply to all requests
23
- - 🛡️ **Request Interception**: Modify headers, body, and query params before sending
24
- - 🎯 **Smart Data Selection**: Pick specific fields with dot notation for nested paths
25
- - 🤖 **Auto Type Inference**: Transform response data with automatic TypeScript type inference
26
- - ⚡ **Automatic Generation**: Single command generates all composables and server routes
27
- - 💚 **100% Nuxt Native**: Generated composables use `useFetch` / `useAsyncData`; server routes use `defineEventHandler` — no third-party runtime required
28
- - 📦 **Zero Runtime Dependencies**: Generated code only uses Nuxt built-ins
29
- - 💡 **Developer Experience**: Interactive CLI with smart defaults
25
+ # Or as a Nuxt module (dev dependency)
26
+ npm install -D nuxt-openapi-hyperfetch
27
+ ```
30
28
 
31
29
  ---
32
30
 
33
- ## 🔧 Generator Engines
34
-
35
- Two generation engines are available. The CLI will ask you to choose one when running `nxh generate`:
31
+ ## What it does
36
32
 
37
- | Engine | Tool | Node Native | Best for |
38
- |--------|------|:---:|----------|
39
- | **official** | [@openapitools/openapi-generator-cli](https://openapi-generator.tech/) | ❌ Requires Java 11+ | Maximum spec compatibility, enterprise projects |
40
- | **heyapi** | [@hey-api/openapi-ts](https://heyapi.dev/) | ✅ Yes | Quick setup, CI/CD pipelines, Node-only environments |
33
+ Point it at an OpenAPI spec, pick an output folder, run one command. You get four kinds of output:
41
34
 
42
- > The CLI checks for Java automatically when `official` is selected and aborts with an install link if it is not found. Get Java at [adoptium.net](https://adoptium.net).
35
+ - **`useFetch` composables** one per endpoint, reactive, bound to template lifecycle
36
+ - **`useAsyncData` composables** — SSR-compatible, awaitable, ideal for page-level data
37
+ - **Nuxt Server Routes** — generated proxy endpoints that keep API keys server-side
38
+ - **Connectors** — headless UI composables (one per resource tag) that combine list, detail, create, update, and delete into a single import — with Zod validation, modal state, reactive params, and pagination built in
43
39
 
44
- You can also pre-select the engine in your `nxh.config.js` the CLI will skip the prompt entirely:
45
-
46
- ```js
47
- // nxh.config.js
48
- export default {
49
- generator: 'openapi', // 'openapi' | 'heyapi'
50
- input: './swagger.yaml',
51
- output: './api',
52
- };
53
- ```
40
+ All output is 100% Nuxt-native. No runtime dependencies in the generated code.
54
41
 
55
42
  ---
56
43
 
57
- ## 📦 Installation
44
+ ## Also generates: `useFetch` and `useAsyncData` composables
58
45
 
59
- ### Use as CLI
46
+ One composable per endpoint, for when you need direct control:
60
47
 
61
- ```bash
62
- npm install -g nuxt-openapi-hyperfetch
63
- # or
64
- yarn global add nuxt-openapi-hyperfetch
65
- # or
66
- pnpm add -g nuxt-openapi-hyperfetch
67
- ```
68
-
69
- Or use directly with npx:
48
+ ```ts
49
+ // useFetch reactive, bound to template lifecycle
50
+ const { data: pet, pending, error } = useFetchGetPetById({ petId: 123 })
70
51
 
71
- ```bash
72
- npx nuxt-openapi-hyperfetch generate
52
+ // useAsyncData — SSR-compatible, awaitable
53
+ const { data: pets } = await useAsyncDataFindPets({ status: 'available' })
73
54
  ```
74
55
 
75
- ### Use as Nuxt module
56
+ With callbacks and request modification:
76
57
 
77
- Install it in your Nuxt project:
58
+ ```ts
59
+ // useFetch — onRequest receives ctx and must return modifications
60
+ const { data } = useFetchFindPets(
61
+ { status: 'available' },
62
+ {
63
+ onRequest: (ctx) => {
64
+ // ctx: { url, method, headers, query, body }
65
+ return { headers: { 'X-Source': 'pets-page' } }
66
+ },
67
+ onSuccess: (pets) => console.log(`${pets.length} pets loaded`),
68
+ onError: (err) => console.error(err.message),
69
+ onFinish: ({ success }) => console.log('Done:', success),
70
+ }
71
+ )
78
72
 
79
- ```bash
80
- npm install -D nuxt-openapi-hyperfetch
81
- # or
82
- pnpm add -D nuxt-openapi-hyperfetch
83
- # or
84
- yarn add -D nuxt-openapi-hyperfetch
73
+ // useAsyncData — onSuccess and onError receive a second context argument
74
+ const { data: pets } = await useAsyncDataFindPets(
75
+ { status: 'available' },
76
+ {
77
+ onRequest: (ctx) => ({ headers: { 'X-Source': 'pets-page' } }),
78
+ onSuccess: (pets, ctx) => console.log(`${pets.length} from ${ctx.url}`),
79
+ onError: (err, ctx) => console.error(err.message, ctx.url),
80
+ }
81
+ )
85
82
  ```
86
83
 
87
- Then register the module in `nuxt.config.ts`:
84
+ ---
88
85
 
89
- ```ts
90
- export default defineNuxtConfig({
91
- modules: ['nuxt-openapi-hyperfetch'],
86
+ ## Also generates: Nuxt Server Routes
92
87
 
93
- openApiHyperFetch: {
94
- input: './swagger.yaml',
95
- output: './composables/api',
96
- generators: ['useFetch', 'useAsyncData'],
97
- backend: 'heyapi',
98
- enableDevBuild: true,
99
- enableProductionBuild: true,
100
- enableAutoGeneration: false,
101
- enableAutoImport: true,
102
- createUseAsyncDataConnectors: false,
103
- },
104
- })
88
+ Proxy endpoints to keep API keys server-side:
89
+
90
+ ```
91
+ Client Nuxt Server Route (generated) → External API
105
92
  ```
106
93
 
107
- The module uses `openApiHyperFetch` as its Nuxt config key and runs generation during Nuxt build hooks. If you include `nuxtServer` in `generators`, you can also configure `serverRoutePath` and `enableBff` here.
94
+ ```ts
95
+ // Works automatically after generation
96
+ const { data } = useFetch('/api/pet/123')
97
+ ```
108
98
 
109
99
  ---
110
100
 
111
- ## 🚀 Quick Start
101
+ ## Connectors
112
102
 
113
- ### 1. Run the generator with the CLI
103
+ A connector exposes five sub-composables for one resource. For a `pet` tag in your spec:
114
104
 
115
- <p align="center">
116
- <img src="./public/nuxt-openapi-hyperfetch-cli.png" alt="Nuxt OpenAPI Hyperfetch CLI" width="720" />
117
- </p>
118
-
119
- ```bash
120
- nxh generate
105
+ ```ts
106
+ const { getAll, get, create, update, del } = usePetsConnector()
121
107
  ```
122
108
 
123
- The CLI will ask you for:
109
+ ### Full CRUD page in one component
124
110
 
125
- - 📂 Path to your OpenAPI/Swagger file (`.yaml` or `.json`)
126
- - 📁 Output directory for generated files
127
- - 🔧 Which generation engine to use (`official` or `heyapi`)
128
- - ✅ Which composables to generate (`useFetch`, `useAsyncData`, `Nuxt server routes`)
111
+ ```vue
112
+ <script setup lang="ts">
113
+ const { getAll, create, update, del } = usePetsConnector()
129
114
 
130
- Or pass arguments directly:
115
+ // Reload the list after every mutation
116
+ create.onSuccess(() => getAll.load())
117
+ update.onSuccess(() => getAll.load())
118
+ del.onSuccess(() => getAll.load())
119
+ </script>
131
120
 
132
- ```bash
133
- nxh generate -i ./swagger.yaml -o ./api
121
+ <template>
122
+ <!-- List -->
123
+ <UTable
124
+ :columns="getAll.columns.value"
125
+ :rows="getAll.items.value"
126
+ :loading="getAll.loading.value"
127
+ >
128
+ <template #actions-data="{ row }">
129
+ <UButton @click="update.ui.open(row)">Edit</UButton>
130
+ <UButton color="red" @click="del.ui.open(row)">Delete</UButton>
131
+ </template>
132
+ </UTable>
133
+
134
+ <!-- Create -->
135
+ <UButton @click="create.ui.open()">Add pet</UButton>
136
+ <UModal v-model:open="create.ui.isOpen.value">
137
+ <UCard>
138
+ <UFormField label="Name" :error="create.errors.value.name?.[0]">
139
+ <UInput v-model="create.model.value.name" />
140
+ </UFormField>
141
+ <UFormField label="Status">
142
+ <USelect v-model="create.model.value.status"
143
+ :options="['available','pending','sold']" />
144
+ </UFormField>
145
+ <template #footer>
146
+ <UButton :loading="create.loading.value" @click="create.execute()">Save</UButton>
147
+ </template>
148
+ </UCard>
149
+ </UModal>
150
+
151
+ <!-- Edit -->
152
+ <UModal v-model:open="update.ui.isOpen.value">
153
+ <UCard>
154
+ <UInput v-model="update.model.value.name" />
155
+ <template #footer>
156
+ <UButton :loading="update.loading.value"
157
+ @click="update.execute(update.model.value.id)">Save changes</UButton>
158
+ </template>
159
+ </UCard>
160
+ </UModal>
161
+
162
+ <!-- Delete confirmation -->
163
+ <UModal v-model:open="del.ui.isOpen.value">
164
+ <UCard>
165
+ <p>Delete <strong>{{ del.staged.value?.name }}</strong>?</p>
166
+ <template #footer>
167
+ <UButton color="red" :loading="del.loading.value" @click="del.execute()">Delete</UButton>
168
+ <UButton variant="outline" @click="del.ui.close()">Cancel</UButton>
169
+ </template>
170
+ </UCard>
171
+ </UModal>
172
+ </template>
134
173
  ```
135
174
 
136
- ### 2. Or generate through the Nuxt module
175
+ ### What each sub-connector provides
137
176
 
138
- If you prefer generation to run from Nuxt itself, add the module and configure it in `nuxt.config.ts`:
177
+ | Key | Transport | What you get |
178
+ |---|---|---|
179
+ | `getAll` | `useAsyncData` | `items`, `columns`, `loading`, `error`, `pagination`, `selected`, `load()` |
180
+ | `get` | `$fetch` | `data`, `loading`, `error`, `load(id)`, `clear()` |
181
+ | `create` | `$fetch` | `model`, `errors`, `isValid`, `execute()`, `reset()`, `ui.open/close` |
182
+ | `update` | `$fetch` | Same as create + `load(id)`, `ui.open(row)`, `targetId` |
183
+ | `del` | `$fetch` | `staged`, `hasStaged`, `execute()`, `ui.open(item)/close` |
184
+
185
+ ### Reactive list parameters
139
186
 
140
187
  ```ts
141
- export default defineNuxtConfig({
142
- modules: ['nuxt-openapi-hyperfetch'],
188
+ const status = ref('available')
143
189
 
144
- openApiHyperFetch: {
145
- input: './swagger.yaml',
146
- output: './composables/api',
147
- generators: ['useFetch', 'useAsyncData', 'nuxtServer'],
148
- backend: 'heyapi',
149
- serverRoutePath: 'server/routes/api',
150
- enableBff: false,
151
- enableAutoImport: true,
152
- enableAutoGeneration: true,
153
- },
154
- })
190
+ // Re-fetches automatically when status changes
191
+ const { getAll } = usePetsConnector(() => ({ status: status.value }))
155
192
  ```
156
193
 
157
- Useful module options:
194
+ ### Zod validation, out of the box
158
195
 
159
- - `input`: OpenAPI file path relative to the Nuxt root.
160
- - `output`: Directory where the generated SDK/composables are written.
161
- - `generators`: Any combination of `useFetch`, `useAsyncData`, and `nuxtServer`.
162
- - `backend`: `heyapi` or `official`.
163
- - `enableDevBuild` / `enableProductionBuild`: Control generation before dev/build.
164
- - `enableAutoGeneration`: Regenerate when the input spec changes in dev mode.
165
- - `enableAutoImport`: Auto-register generated composables for Nuxt auto-imports.
166
- - `createUseAsyncDataConnectors`: Generate headless connectors on top of `useAsyncData`.
167
- - `serverRoutePath`: Output path for generated Nuxt server routes.
168
- - `enableBff`: Enable the BFF transformer layer for server routes.
196
+ Schemas are generated from your OpenAPI `requestBody`. `create.execute()` validates before sending — the network call is never made if the data is invalid.
169
197
 
170
- ### 3. Generated output
171
-
172
- ```
173
- api/
174
- +-- runtime.ts
175
- +-- apis/
176
- │ +-- PetApi.ts
177
- │ +-- StoreApi.ts
178
- +-- models/
179
- │ +-- Pet.ts
180
- │ +-- Order.ts
181
- +-- composables/
182
- +-- use-fetch/
183
- +-- runtime/
184
- │ +-- useApiRequest.ts
185
- +-- composables/
186
- │ +-- useFetchGetPetById.ts
187
- │ +-- useFetchAddPet.ts
188
- +-- index.ts
198
+ ```ts
199
+ // Extend the generated schema for extra rules
200
+ const { create } = usePetsConnector({}, {
201
+ createSchema: (base) => base.extend({
202
+ name: z.string().min(2, 'At least 2 characters'),
203
+ })
204
+ })
189
205
  ```
190
206
 
191
- ### 4. Configure the API base URL
207
+ ### Global callbacks
192
208
 
193
- Add to `nuxt.config.ts`:
209
+ Register once, applies to every API call in the app:
194
210
 
195
- ```typescript
196
- export default defineNuxtConfig({
197
- runtimeConfig: {
198
- public: {
199
- apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL || 'https://api.example.com'
200
- }
211
+ ```ts
212
+ // plugins/api-callbacks.plugin.ts
213
+ defineGlobalApiCallbacks([
214
+ {
215
+ onRequest: (ctx) => ({
216
+ headers: { Authorization: `Bearer ${useAuthStore().token}` }
217
+ }),
218
+ onError: (err) => useToast().add({ title: err.message, color: 'red' }),
201
219
  }
202
- })
220
+ ])
203
221
  ```
204
222
 
205
- And in `.env`:
223
+ Connector-level and per-operation callbacks are also available — see [Callbacks docs](./docs/connectors/callbacks.md).
206
224
 
207
- ```env
208
- NUXT_PUBLIC_API_BASE_URL=https://api.example.com
209
- ```
225
+ ---
210
226
 
211
- All generated `useFetch` and `useAsyncData` composables will automatically use this as `baseURL`. You can still override it per-composable via `options.baseURL`.
227
+ ## Quick Start
212
228
 
213
- ### 5. Use in your Nuxt app
229
+ ### CLI
214
230
 
215
- ```vue
216
- <script setup lang="ts">
217
- import { useFetchGetPetById } from '@/api/composables/use-fetch';
218
-
219
- const { data: pet, pending, error } = useFetchGetPetById(
220
- { petId: 123 },
221
- {
222
- onSuccess: (pet) => console.log('Loaded:', pet.name),
223
- onError: (err) => console.error('Failed:', err),
224
- }
225
- );
226
- </script>
231
+ <p align="center">
232
+ <img src="https://raw.githubusercontent.com/dmartindiaz/nuxt-openapi-hyperfetch/main/public/nuxt-openapi-hyperfetch-cli.png" alt="Nuxt OpenAPI Hyperfetch CLI" width="720" />
233
+ </p>
227
234
 
228
- <template>
229
- <div>
230
- <div v-if="pending">Loading...</div>
231
- <div v-else-if="error">Error: {{ error }}</div>
232
- <div v-else-if="pet">{{ pet.name }} — {{ pet.status }}</div>
233
- </div>
234
- </template>
235
+ ```bash
236
+ nxh generate
237
+ # or with arguments:
238
+ nxh generate -i ./swagger.yaml -o ./composables/api
235
239
  ```
236
240
 
237
- ---
241
+ The CLI asks for your spec path, output folder, engine (`heyapi` or `official`), and which generators to run.
238
242
 
239
- ## 🖥️ Nuxt Server Routes Generator
243
+ ### Nuxt module
240
244
 
241
- In addition to client-side composables, you can generate **Nuxt Server Routes** that proxy requests to your backend API—keeping API keys and secrets server-side.
245
+ ```ts
246
+ // nuxt.config.ts
247
+ export default defineNuxtConfig({
248
+ modules: ['nuxt-openapi-hyperfetch'],
242
249
 
243
- ```
244
- Client → Nuxt Server Route (generated) → External API
250
+ openApiHyperFetch: {
251
+ input: './swagger.yaml',
252
+ output: './composables/api',
253
+ generators: ['useFetch', 'useAsyncData', 'nuxtServer'],
254
+ backend: 'heyapi',
255
+ enableAutoImport: true,
256
+ },
257
+ })
245
258
  ```
246
259
 
247
- After generation, configure your backend URL in `.env`:
260
+ ### Configure the base URL
248
261
 
249
- ```env
250
- API_BASE_URL=https://your-backend-api.com/api
251
- API_SECRET=your-secret-token
262
+ ```ts
263
+ // nuxt.config.ts
264
+ runtimeConfig: {
265
+ public: { apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL || 'https://api.example.com' }
266
+ }
252
267
  ```
253
268
 
254
- And add it to `nuxt.config.ts`:
269
+ All generated composables and connectors pick up `apiBaseUrl` automatically.
255
270
 
256
- ```typescript
257
- export default defineNuxtConfig({
258
- runtimeConfig: {
259
- // Private — server-side only (never exposed to the browser)
260
- apiBaseUrl: process.env.API_BASE_URL || '',
261
- apiSecret: process.env.API_SECRET || '',
262
- },
263
- });
264
- ```
271
+ ---
265
272
 
266
- > **Note:** `runtimeConfig.apiBaseUrl` (private) is only for **Server Routes**. For `useFetch`/`useAsyncData` composables use `runtimeConfig.public.apiBaseUrl` instead — see the [Quick Start](#-quick-start) section above.
273
+ ## Two generation engines
267
274
 
268
- Then use standard `useFetch` against your Nuxt routes:
275
+ | Engine | Requires | Best for |
276
+ |---|---|---|
277
+ | `heyapi` | Node only | Quick setup, CI/CD |
278
+ | `official` | Java 11+ | Maximum spec compatibility |
269
279
 
270
- ```typescript
271
- const { data: pet } = useFetch('/api/pet/123');
272
- ```
280
+ Pre-select in `nxh.config.js` to skip the prompt:
273
281
 
274
- > **BFF (Backend for Frontend) mode** is also available — generates a transformer layer for auth context, data enrichment, and permission filtering without ever overwriting your custom code. See the [Server Routes Guide](./docs/DEVELOPMENT.md) for details.
282
+ ```js
283
+ export default { generator: 'heyapi', input: './swagger.yaml', output: './api' }
284
+ ```
275
285
 
276
286
  ---
277
287
 
278
- ## 📚 Documentation
288
+ ## Documentation
279
289
 
280
- | Guide | Description |
281
- |-------|-------------|
282
- | [Quick Start Guide](./docs/QUICK-START.md) | Understand the project in 5 minutes |
283
- | [Architecture](./docs/ARCHITECTURE.md) | Design patterns, two-stage generation, shared code |
284
- | [API Reference](./docs/API-REFERENCE.md) | All CLI options, TypeScript types, composable APIs |
285
- | [Development Guide](./docs/DEVELOPMENT.md) | Contributing, adding generators, code style |
290
+ | | |
291
+ |---|---|
292
+ | [Connectors](./docs/connectors/index.md) | Full connector API reference and examples |
293
+ | [Quick Start](./docs/QUICK-START.md) | From zero to working composables in 5 minutes |
294
+ | [API Reference](./docs/API-REFERENCE.md) | All options and TypeScript types |
295
+ | [Architecture](./docs/ARCHITECTURE.md) | How the generator works internally |
286
296
  | [Troubleshooting](./docs/TROUBLESHOOTING.md) | Common errors and solutions |
287
297
 
288
298
  ---
289
299
 
290
- ## 🤝 Contributing
291
-
292
- Contributions are welcome! Please read the [Contributing Guidelines](./CONTRIBUTING.md) before submitting a PR.
300
+ ## Contributing
293
301
 
294
302
  ```bash
295
- # Development setup
296
303
  npm install
297
304
  npm run build
298
305
  npm run validate # lint + type check
299
306
  ```
300
307
 
301
- ---
308
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
302
309
 
303
- ## 📄 License
304
-
305
- Apache-2.0 — see [LICENSE](./LICENSE) for details.
306
310
 
307
311
  ---
308
312
 
309
- **Made with ❤️ for Nuxt developers**
313
+ ## License
314
+
315
+ Apache-2.0 — see [LICENSE](./LICENSE) for details.