{"id":13725553,"url":"https://github.com/lukeed/svelte-ssr-worker","last_synced_at":"2025-10-09T18:24:57.372Z","repository":{"id":40636910,"uuid":"217582791","full_name":"lukeed/svelte-ssr-worker","owner":"lukeed","description":"A quick demo for rendering Svelte server-side (SSR), but within a Cloudflare Worker!","archived":false,"fork":false,"pushed_at":"2020-10-13T21:33:59.000Z","size":22,"stargazers_count":153,"open_issues_count":0,"forks_count":9,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-08-04T01:27:50.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://cloudflareworkers.com/#9e1f81f41405f8851b39f4643ce12754:https://tutorial.cloudflareworkers.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukeed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-25T17:24:16.000Z","updated_at":"2024-06-22T11:32:26.000Z","dependencies_parsed_at":"2022-09-14T10:12:01.159Z","dependency_job_id":null,"html_url":"https://github.com/lukeed/svelte-ssr-worker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fsvelte-ssr-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fsvelte-ssr-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fsvelte-ssr-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fsvelte-ssr-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/svelte-ssr-worker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224645406,"owners_count":17346148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:02:27.153Z","updated_at":"2025-10-09T18:24:52.334Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# svelte-ssr-worker\n\n\u003e A quick demo for rendering Svelte server-side (SSR), but within a [Cloudflare Worker](https://workers.cloudflare.com/)!\n\n[Live Demo](https://cloudflareworkers.com/#9e1f81f41405f8851b39f4643ce12754:https://tutorial.cloudflareworkers.com/)\n\nThis is a demo meant to illustrate how to get Svelte SSR in a Cloudflare worker. It is _intentionally_ very minimal – it extends the official [`svelte-template`](https://github.com/sveltejs/template).\n\n\n## Install\n\n```sh\n$ git clone https://github.com/lukeed/svelte-ssr-worker\n$ cd svelte-ssr-worker\n$ npm install\n```\n\n## Scripts\n\nThe following are `npm` scripts included in the project.\u003cbr\u003e\nThey are invoked via `npm run \u003cname\u003e` on the command line; for example: `npm run build:dom`.\n\n### `build`\n\nThis is an alias for _sequentially_ running the `build:dom` and `build:ssr` scripts.\n\n\u003e **Note:** These are sequential because `build:ssr` imports the `public/index.html` that `build:dom` produces.\n\n\n### `build:dom`\n\nBuilds the client for production, using the `src/index.dom.js` entry point.\n\nAll files within the `/public` directory comprise your front-end client application.\n\n\u003e **Important:** These must be uploaded to a storage bucket and made available on a CDN location. \u003cbr\u003eAlternatively, you may upload `/public` as a [static Workers Site](https://developers.cloudflare.com/workers/platform/sites/start-from-existing).\n\n\n### `build:ssr`\n\nBuilds your Cloudflare Worker code, using the `src/index.ssr.js` entry point.\n\nThe final worker file is saved to `build/index.js`, which can be deployed to your Cloudflare Worker directly.\n\n\u003e **Note:** Deployment is not included in this template.\n\n\u003e **Important:** This script _must run after_ `build:dom` because it relies on its `public/index.html` output.\n\n### `start`\n\nStarts a local development server.\u003cbr\u003e\nThis is used to preview/visit your front-end application _only_.\n\n\u003e **Note:** This does not run your Worker code.\n\n### `watch`\n\nThis is an alias for running the `start` and `watch:dom` scripts simultaneously.\n\n### `watch:dom`\n\nWatches your `src/index.dom.js` and its imports for changes.\n\n### `watch:ssr`\n\nWatches your `src/index.ssr.js` and its imports for changes.\n\n\n## Deploy\n\nYou should have a storage bucket setup and attached to a CDN ahead of time.\u003cbr\u003e\nOnce the CDN address is known, you will need to update the `{{CDN}}` value within `config/shared.js`.\n\nThen, after a successful `build`, you will need to:\n\n* Upload `public/*` to your storage bucket (or similar)\n* Upload `build/index.js` to Cloudflare Workers\n\n\u003e **Note:** Cloudflare's `wrangler` can handle both of these steps!\n\nYou're done~! :tada:\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fsvelte-ssr-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fsvelte-ssr-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fsvelte-ssr-worker/lists"}