Nuxt and Nitro
Mount the browser proxy and webhook as separate Nitro handlers. Resolve trusted user and active-organization context from the native event on the proxy path.
Create the integration
server/utils/incld.ts
ts
import { createIncld, defineActions } from "@incld/client/nuxt"
export const incld = createIncld({
apiKey: process.env.INCLD_SECRET_KEY!,
webhookSecret: process.env.INCLD_WEBHOOK_SECRET!,
actions: defineActions({ rebuild_index: { run: rebuildIndex } }),
async resolveContext(_request, event) {
const session = await requireUserSession(event)
return session?.organizationId
? {
user: { id: session.user.id },
organization: { id: session.organizationId },
roles: session.user.roles,
}
: null
},
async authorize({ context, operation }) {
return hasPermission(context, operation)
},
})
Mount Nitro handlers
server/api/incld/v1/[...path].ts
ts
import { incld } from "~/server/utils/incld"
export default defineEventHandler(event => incld.routes(event))
server/api/incld/webhook.post.ts
ts
import { incld } from "~/server/utils/incld"
export default defineEventHandler(event => incld.webhook(event))
Connect the frontend
Use IncldBrowser
with the relative /api/incld
base URL from Vue composables or your own component layer. The current supported prebuilt UI is React; the Nuxt backend adapter does not require React.
Deployment notes
| Concern | Requirement |
|---|---|
| Runtime | A Fetch API compatible Nitro runtime. |
| Secrets | Private runtime configuration only; never runtimeConfig.public. |
| Body | Do not transform the webhook body before the adapter verifies it. |
| Actions | Run incld.syncActions() from a deployment task or bounded server startup hook. |