SvelteKit adapter for ObjectStack — server endpoints and
handlehook for the auto-generated REST API.
Bridges SvelteKit request events to HttpDispatcher. Ship ObjectStack either as a catch-all +server.ts route or as a handle hook for global interception.
pnpm add @objectstack/sveltekit// src/routes/api/[...path]/+server.ts
import { createRequestHandler } from '@objectstack/sveltekit';
import { kernel } from '$lib/server/kernel';
const handler = createRequestHandler({ kernel });
export const GET = handler;
export const POST = handler;
export const PUT = handler;
export const PATCH = handler;
export const DELETE = handler;// src/hooks.server.ts
import { sequence } from '@sveltejs/kit/hooks';
import { createHandle } from '@objectstack/sveltekit';
import { kernel } from '$lib/server/kernel';
export const handle = sequence(createHandle({ kernel, prefix: '/api' }));| Export | Kind | Description |
|---|---|---|
createRequestHandler(options) |
function | Returns a RequestHandler for catch-all routes. |
createHandle(options) |
function | Returns a SvelteKit Handle hook. |
SvelteKitAdapterOptions |
interface | { kernel, prefix? }. |
- ✅ SvelteKit 2.x applications.
- ✅ Projects preferring the
handlehook over route files.
- ❌ Sapper and SvelteKit 1.x are not supported.
- 📖 Docs: https://objectstack.ai/docs
- 📚 API Reference: https://objectstack.ai/docs/references
Apache-2.0 © ObjectStack