docs(guides): add SvelteKit deployment guide#976
Open
robinbdru wants to merge 6 commits into
Open
Conversation
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>
✅ Review app deployedCheck how your changes look like!
|
Author
|
A few details:
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 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:
CC_WEBROOTandCC_PRE_BUILD_HOOKneed to be set explicitly. The hook is only needed to triggervite build— Clever Cloud runs dependency installation automatically as a separate step.CC_NODE_BUILD_TOOL="pnpm"is auto-detected frompnpm-lock.yaml, so it's annotated as optional in the pnpm tabs.sv createusevite.config.ts, notsvelte.config.js, so all adapter configurations use the Vite plugin syntax introduced in recent SvelteKit versions.PROTOCOL_HEADERandHOST_HEADERare preferred over a hardcodedORIGINso the configuration works with bothcleverapps.ioand custom domains without extra changes.I also added an inline comment on
clever deployinshared/static-deploy.mdpointing 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)
🧪 Type of Change
✅ 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.mdis a one-line comment addition toshared/static-deploy.md.