No description
- JavaScript 54.9%
- Svelte 33.5%
- HTML 7.7%
- TypeScript 3.9%
| .github/workflows | ||
| scripts | ||
| src | ||
| .gitignore | ||
| .prettierignore | ||
| eslint.config.js | ||
| package.json | ||
| pnpm-lock.yaml | ||
| prettier.config.js | ||
| README.md | ||
| svelte.config.js | ||
| tsconfig.json | ||
| vite.config.ts | ||
SvelteKit Cloudflare Pages Template
Minimal SvelteKit starter for Cloudflare Pages with production deploys, per-PR preview deploys, sticky preview comments, and preview cleanup workflows.
Use This Template
- Create a new repository from this template.
- Create a Cloudflare Pages project. Its name must match the
CLOUDFLARE_PROJECT_NAMErepository variable. - Configure repository Actions variables:
CLOUDFLARE_ACCOUNT_ID: your Cloudflare account ID.CLOUDFLARE_PROJECT_NAME: your Cloudflare Pages project name.
- Configure repository Actions secrets:
CLOUDFLARE_API_TOKEN: a Cloudflare API token with Pages edit access for the project.
The Forgejo or GitHub runner token is provided automatically as GITHUB_TOKEN; it is used for preview PR comments.
Commands
pnpm install
pnpm dev
pnpm build
pnpm check
The build uses @sveltejs/adapter-cloudflare, then copies the adapter output to build because the included workflows deploy that directory with Wrangler.
Workflows
CI: installs dependencies, builds the app, and runs Svelte checks on pushes tomainand pull requests.Deploy to Cloudflare Pages: deploysmainto production whenCLOUDFLARE_ACCOUNT_ID,CLOUDFLARE_PROJECT_NAME, andCLOUDFLARE_API_TOKENare configured.Preview deploy: opens or updates a Cloudflare Pages preview deployment for each same-repository pull request, then posts or updates a sticky PR comment with the preview URL.Preview cleanup: deletes a PR preview when the PR closes, updates the sticky comment, and includes a manualworkflow_dispatchsweep for orphaned preview deployments.
Push to main for a production deploy. Open a pull request for a preview deploy. Close a pull request to remove its preview. Run the manual Preview cleanup workflow to sweep orphaned previews.
External Actions
The workflows depend on these external actions:
https://rasterhub.com/rasterstate/setup-node-action@v1https://rasterhub.com/rasterstate/setup-pnpm-action@v1
Project Files
src/routes/+page.svelte: placeholder landing page.svelte.config.js: SvelteKit configured with@sveltejs/adapter-cloudflare..github/workflows/: CI, production deploy, preview deploy, and preview cleanup workflows.