Skip to content

docs(guides): add SvelteKit deployment guide#976

Open
robinbdru wants to merge 6 commits into
CleverCloud:mainfrom
robinbdru:main
Open

docs(guides): add SvelteKit deployment guide#976
robinbdru wants to merge 6 commits into
CleverCloud:mainfrom
robinbdru:main

Conversation

@robinbdru

@robinbdru robinbdru commented Jun 28, 2026

Copy link
Copy Markdown

📝 What does this PR do?

Adds a SvelteKit deployment guide covering the three rendering modes supported on Clever Cloud: SSG (static site generation), SPA (single-page application), and SSR (server-side rendering).

I tested this against a real Clever Cloud deployment rather than writing from documentation alone, which surfaced a few things worth knowing:

  • The static runtime doesn't auto-detect SvelteKit, so CC_WEBROOT and CC_PRE_BUILD_HOOK need to be set explicitly. The hook is only needed to trigger vite build — Clever Cloud runs dependency installation automatically as a separate step.
  • CC_NODE_BUILD_TOOL="pnpm" is auto-detected from pnpm-lock.yaml, so it's annotated as optional in the pnpm tabs.
  • Projects created with sv create use vite.config.ts, not svelte.config.js, so all adapter configurations use the Vite plugin syntax introduced in recent SvelteKit versions.
  • PROTOCOL_HEADER and HOST_HEADER are preferred over a hardcoded ORIGIN so the configuration works with both cleverapps.io and custom domains without extra changes.

I also added an inline comment on clever deploy in shared/static-deploy.md pointing to the git remote alternative. This is a one-line change that benefits the other static guides using that shared block.

🔗 Related Issue (if applicable)

  • Closes #
  • Related to #

🧪 Type of Change

  • ⚠️ Bug fix
  • 📅 Changelog update
  • 📚 Documentation update
  • ✨ New content/feature
  • 🔧 Technical/maintenance

✅ Quick Checklist


👥 Reviewers

@CleverCloud/reviewers


📋 For major changes (click to expand)

Additional testing performed

Deployed a SvelteKit app to Clever Cloud (both static and SSR modes) and verified the configuration end to end. The guide reflects what the deployment logs actually show.

Screenshots

N/A — text-only guide.

Breaking changes

None. The only change outside of content/guides/sveltekit.md is a one-line comment addition to shared/static-deploy.md.

robinbdru and others added 5 commits June 28, 2026 10:53
Covers all three SvelteKit rendering modes:
- SSG with adapter-static and the Static runtime
- SPA with adapter-static and a fallback page
- SSR with adapter-node and the Node.js runtime

Documents Clever Cloud-specific configuration:
- CC_WEBROOT and CC_PRE_BUILD_HOOK for static deployments
- PORT=8080 requirement for SSR (SvelteKit defaults to 3000)
- PROTOCOL_HEADER and HOST_HEADER for dynamic origin
  reconstruction behind Clever Cloud's reverse proxy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
npm create svelte@latest has been replaced by npx sv create

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace svelte.config.js with vite.config.ts: adapter is now
  configured via the sveltekit() Vite plugin
- Add npm/pnpm tabs for scaffold, static env vars, and SSR env vars
- Use CC_NODE_BUILD_TOOL=pnpm (native support since Aug 2025)
  instead of the outdated custom build tool approach

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…LD_TOOL in SvelteKit guide

Clever Cloud installs dependencies automatically; CC_PRE_BUILD_HOOK is only
needed to trigger vite build. CC_NODE_BUILD_TOOL="pnpm" is auto-detected from
pnpm-lock.yaml and annotated as optional in both the static and SSR pnpm tabs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Inline comment on clever deploy lines pointing to the git remote URL
in the app's Information tab. Applied to both the SvelteKit SSR section
and the shared static-deploy block (used by 10 static guides).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

✅ Review app deployed

Check how your changes look like!

ℹ️ Name 🔗 Infos & links
🌱 Latest deployed commit f109d7a
👁️ Preview https://documentation-PR-976.cleverapps.io/developers

@robinbdru

Copy link
Copy Markdown
Author

A few details:

  • Most of the content was written by Claude Code. I knew what I wanted to achieve but not how to write it; I relied heavily on the Nuxt guide.
  • I then tested each item and made adjustments accordingly. That is, in particular, how I came to understand the importance of environment variables and build hooks.
  • This is my first contribution to a public project; I followed the contribution guidelines as closely as possible, and I look forward to your feedback to help improve my future contributions.

CC_PRE_BUILD_HOOK runs before Clever Cloud's automatic dependency
fetch, not instead of it, so 'npm install && npm run build' in the
hook caused a second, redundant install right after the first.

Use CC_NODE_DEV_DEPENDENCIES=install so the automatic fetch installs
devDependencies (vite, @sveltejs/kit), and move the build command to
CC_POST_BUILD_HOOK, which runs after that fetch completes. Verified
on a live deploy: single install pass, build time dropped from ~20s
to ~8s.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants