---
title: "@slicemachine/adapter-sveltekit v0.0"
category: "api-references"
audience: developers
lastUpdated: "2025-11-06T01:07:50.000Z"
---

`@slicemachine/adapter-sveltekit` adds support for SvelteKit in Slice Machine.

# Dependencies and requirements

This package works in a SvelteKit project with [`slice-machine-ui`](https://prismic.io/docs/technical-reference/slice-machine-ui) installed.

# Installation

The best way to configure a project with Slice Machine is by running the following command in a SvelteKit project. This command will install `@slicemachine/adapter-sveltekit` along with other Prismic packages and add Prismic-specific configurations to your project.

```bash
npx @slicemachine/init@latest
```

For more information on configuring a SvelteKit project with Slice Machine, [see our SvelteKit guide](https://prismic.io/docs/sveltekit.md).

If you want to install this package on its own, run this command:

```bash
npm install --save-dev @slicemachine/adapter-sveltekit
```

# Usage

To use this adapter, specify it in the `adapter` property of your `slicemachine.config.json` file:

```json filename=slicemachine.config.json
{
  "repositoryName": "example-prismic-repo",
  "adapter": "@slicemachine/adapter-sveltekit",
  "libraries": ["./src/lib/slices"],
  "localSliceSimulatorURL": "http://localhost:5173/slice-simulator"
}
```

You can also specify options for the adapter:

```json filename=slicemachine.config.json
{
  "repositoryName": "example-prismic-repo",
  "adapter": {
    "resolve": "@slicemachine/adapter-sveltekit",
    "options": {
      "typescript": true
    }
  },
  "libraries": ["./src/lib/slices"]
}
```

Here are the available options:

<Table>
  <tbody>
    <tr>
      <TableCell>`format` boolean</TableCell>

      <TableCell>
        Determines if generated files should be formatted using Prettier (default: `true`).
      </TableCell>
    </tr>

    <tr>
      <TableCell>`typescript` boolean</TableCell>

      <TableCell>
        Determines if generated files should use TypeScript rather than JavaScript (default: `true` only if the project contains a `tsconfig.json` file, otherwise `false`).
      </TableCell>
    </tr>

    <tr>
      <TableCell>`generatedTypesFilePath` string</TableCell>

      <TableCell>
        A filepath denoting where generated TypeScript types will be saved (default: `prismicio-types.d.ts`).
      </TableCell>
    </tr>
  </tbody>
</Table>

In order to simulate slices in Slice Machine, the adapter requires a page that renders the` <SliceSimulator>` component from `@slicemachine/adapter-sveltekit/simulator`. The URL for this page should be specified in the `localSliceSimulatorURL` property of `slicemachine.config.json`.

```html filename=src/routes/slice-simulator/+page.svelte
<script>
  import { SliceSimulator } from "@slicemachine/adapter-sveltekit/simulator";
  import { SliceZone } from "@prismicio/svelte";
  import { components } from "$lib/slices";
</script>

<SliceSimulator let:slices>
  <SliceZone {slices} {components} />
</SliceSimulator>
```
