Run a SvelteKit App
This guide assumes that you have a SvelteKit app that you want to run on Space. If you don’t have a SvelteKit app, follow the instructions on the SvelteKit docs to create one.
Configure your SvelteKit app
To run a SvelteKit app on Space, you’ll need to use the SvelteKit node adapter: @sveltejs/adapter-node
. If you already use the Node adapter, skip to the next section.
First, install the @sveltejs/adapter-node
dependency:
npm install @sveltejs/adapter-node
Then, in your svelte.config.js
file, replace the current adapter with the node adapter:
import adapter from '@sveltejs/adapter-node';
// rest of the file
Your project is now configured to run on Space. Let’s run it!
Run it on Space
After making sure you’ve installed the Space CLI, run the following command in your project’s directory:
space new
Follow the prompts to give your app a name. Once that’s done, let’s push your app to Space:
space push
Great job! You’ve just deployed your first SvelteKit app on Space. You can now access your app at the URL provided by the CLI.