- Log into your Cloudflare account.
- Click "Pages" in the left menu.
- Click the "Create a project" button --> "Connect to Git".
- Click "Add account".
- See the GitHub account that contains your repo.
- Select the repo that you want to deploy. Click "Save".
- Select the repo that you just added, then click "Begin setup".
- Follow these instructions for deploying a SvelteKit project: https://developers.cloudflare.com/pages/framework-guides/deploy-a-svelte-site/, but use these settings instead of the ones described in that article:
NOTE: You can look at the other projects you have under the "Pages" link for examples. Click the "Pages" link in the sidebar --> "Settings" tab.
- In your
svelte.config.js
file, use theadapter-auto
that is already installed by default in SvelteKit instead of theadapter-static
that is mentioned in the Cloudflare guide. - When creating a new project in your Cloudflare dashboard, use the "Framework preset" for SvelteKit.
- IMPORTANT: SvelteKit requires Node.js v14.x or later to build successfully. You must expand the
Environment variables (advanced)
section and add aNODE_VERSION
variable with a value of16
or greater. - Click the "Save and Deploy" button.
- Now when you push your code to the
main
branch your app will automatically build and deploy.
NOTE: Follow these instructions to add custom domains, etc: https://developers.cloudflare.com/pages/get-started/.