Docs/Framework integrations

Find the framework route, component prop, SDK method, or HTTP contract you need.

SvelteKit backend

The SvelteKit backend adapter handles authentication, proxying, and webhooks. Note: the Svelte UI components are currently experimental.

Create the integration from event.locals

src/lib/server/incld.ts ts
import { createIncld, defineActions } from "@incld/client/sveltekit"

export const incld = createIncld({
 apiKey: process.env.INCLD_SECRET_KEY!,
 webhookSecret: process.env.INCLD_WEBHOOK_SECRET!,
 actions: defineActions({ export_account: { run: runExport } }),
 async resolveContext(_request, event) {
  const user = event.locals.user
  const organization = event.locals.organization
  return user && organization
   ? {
      user: { id: user.id },
      organization: { id: organization.id },
      roles: user.roles,
     }
   : null
 },
 async authorize({ context, operation }) {
  return eventPermissions(context, operation)
 },
})

Mount SvelteKit server routes

src/routes/api/incld/v1/[...path]/+server.ts ts
import { incld } from "$lib/server/incld"
export const { GET, POST, PATCH, DELETE } = incld.routes
src/routes/api/incld/webhook/+server.ts ts
import { incld } from "$lib/server/incld"
export const POST = incld.webhook

Frontend choices

Build Svelte UI against your same-origin proxy using normal fetch, or embed React components in an appropriate island architecture. Do not publish or depend on @incld/svelte-schedules or @incld/svelte-approvals yet; they do not have the supported React behavior and test contract.