Tilda provides first-class support for SvelteKit applications, making it easy to deploy your Svelte projects. This guide will walk you through the process of deploying a SvelteKit application on Tilda.
First, install the Tilda CLI globally:
npm install -g @tildacloud/cli@latest
Tilda expects a standard SvelteKit project structure. Your project should have:
package.json
file with the necessary SvelteKit dependenciessrc/routes
, src/lib
, etc.)Tilda uses the official @sveltejs/adapter-node
for SvelteKit deployments. Tilda will pass the necessary environment variables to SvelteKit during the build process to configure the adapter.
You don't need to manually configure the adapter or modify your SvelteKit configuration - the build process handles this automatically.
If you have any issues configuring the adapter, refer to SvelteKit's Node servers documentation on how to configure the adapter.
To build your SvelteKit application for deployment, use the tilda build svelte
command:
tilda build svelte
The build command supports several options:
# Specify project directory
tilda build svelte --projectDir ./my-sveltekit-app
# Use custom build command
tilda build svelte --buildCommand 'npm run build:custom'
After building your application, deploy it using:
tilda deploy --project my-project --site my-site
Place your static assets in the static/
directory. They will be automatically served at the root path of your site.
For local development:
npm run dev
tilda build svelte
tilda deploy
Here's an example GitHub Actions workflow:
name: Deploy SvelteKit App
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm ci
- name: Install Tilda CLI
run: npm install -g @tildacloud/cli
- name: Build and Deploy
env:
TILDA_CLI_INLINE_IDENTITY_JSON: ${{ secrets.TILDA_DEPLOYMENT_KEY }}
run: |
tilda build svelte
tilda deploy --project my-project --site my-site
If your build fails, check:
For runtime errors:
Tip: Enable source maps in your production build for better error tracking.