---
title: "Svelte"
locale: "en"
version: "1.x"
canonicalUrl: "https://farmfe.org/docs/1.x/frameworks/svelte"
publicationStatus: "prerelease"
---

<a id="svelte"></a>
# Svelte


Create a ` Svelte ` project based on ` Farm `.


` Farm ` provides two approaches to support creating ` Svelte ` projects:


- Use the ` create-farm ` scaffold to create a scaffold project
- You can manually create a ` Svelte ` project following the current documentation


<a id="creating-a-svelte-project"></a>
### Creating a Svelte Project


**npm**

```sh
npm create farm@latest
```

**pnpm**

```sh
pnpm create farm@latest
```

**yarn**

```sh
yarn create farm@latest
```

**bun**

```sh
bun create farm@latest
```


Select ` Svelte ` template in ` Select Framework `



> [!WARNING]
> Svelte
> 
> For ` Svelte ` support, ` Farm ` recommends using ` Vite ` plugins.



```javascript
import { defineConfig } from '@farmfe/core'
import { svelte } from '@sveltejs/vite-plugin-svelte'

export default defineConfig({
  vitePlugins: [svelte()],
})

```


```javascript
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'

export default {
  preprocess: vitePreprocess(),
}
```


If you want to start DevServer


**npm**

```sh
npm dev
```

**pnpm**

```sh
pnpm dev
```

**yarn**

```sh
yarn dev
```

**bun**

```sh
bun dev
```


If you need to run the build production environment product command


**npm**

```sh
npm build
```

**pnpm**

```sh
pnpm build
```

**yarn**

```sh
yarn build
```

**bun**

```sh
bun build
```


If you need to preview your build product


**npm**

```sh
npm preview
```

**pnpm**

```sh
pnpm preview
```

**yarn**

```sh
yarn preview
```

**bun**

```sh
bun preview
```


For more example details: [Svelte Example](<https://github.com/farm-fe/farm/tree/main/examples/vite-adapter-svelte>)
