Deploy SvelteKit App with Vercel

By Hideki Ishiguro at

I've been fond of Svelte since last year, and just the other day I made a new web app with SvelteKit.
It is deployed with Vercel, but I struggled a little when deploying it so I write how to deploy with Vercel.

1. Create a SvelteKit app

npm init svelte@next my-app
cd my-app
npm install
npm run dev

2. Add an adapter in a configuration file

At first, install the depencency.

npm i -D @sveltejs/adapter-vercel@next

Don't forget to add a suffix (@next) to the package name at this point.

And then, add a value into adapter in a svelte.config.js.

import vercel from '@sveltejs/adapter-vercel';

const config = {
    kit: {
        // ...
        adapter: vercel(),
        // ...

This will output .vercel_build_output/ directory for hosting by Vercel.

3. Push it on GitHub

git init
git add .
git commit -m "first commit"
git remote add origin<YOUR-USER-NAME>/<YOUR-REPOSITORY-NAME>
git push -u origin main

Please see the guides for details.

4. Go to Vercel. It's done.

Ok, Vercel should now build correctly and display your web app.
Go to Vercel and import your git repository.