{"id":13473834,"url":"https://github.com/cloudflare/templates","last_synced_at":"2026-01-11T21:58:42.363Z","repository":{"id":37584075,"uuid":"114788369","full_name":"cloudflare/templates","owner":"cloudflare","description":"Templates for Cloudflare Workers","archived":false,"fork":false,"pushed_at":"2025-12-22T13:46:34.000Z","size":17030,"stargazers_count":1740,"open_issues_count":95,"forks_count":896,"subscribers_count":55,"default_branch":"main","last_synced_at":"2025-12-24T00:12:18.113Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://workers.cloudflare.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-12-19T16:38:32.000Z","updated_at":"2025-12-23T09:11:51.000Z","dependencies_parsed_at":"2024-01-05T20:58:54.600Z","dependency_job_id":"16aa4fcc-0f1b-4c13-8a06-35d40504b919","html_url":"https://github.com/cloudflare/templates","commit_stats":null,"previous_names":["cloudflare/worker-examples"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/cloudflare/templates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Ftemplates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Ftemplates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Ftemplates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Ftemplates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/templates/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Ftemplates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28324679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T18:42:50.174Z","status":"ssl_error","status_checked_at":"2026-01-11T18:39:13.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-31T16:01:07.306Z","updated_at":"2026-01-11T21:58:42.358Z","avatar_url":"https://github.com/cloudflare.png","language":"TypeScript","readme":"# Templates for Cloudflare Workers\n\nCloudflare Workers let you deploy serverless code instantly across the globe for exceptional performance, reliability, and scale. This repository contains a collection of starter templates for building full-stack applications on Workers. **You are encouraged to use, modify, and extend this code!**\n\n## Getting Started\n\nThere are two ways to start building with a template in this repository: the [Cloudflare dashboard](https://dash.cloudflare.com/) and [C3](https://developers.cloudflare.com/pages/get-started/c3/) (the `create-cloudflare` CLI).\n\n### Starting from the Dashboard\n\nAfter logging in or signing up through the [Cloudflare dashboard](https://dash.cloudflare.com/), open the [Workers templates page](https://dash.cloudflare.com/?to=/:account/workers-and-pages/templates) and select a template to get started with. From here, you can create a repository and deploy your first Worker without needing a local development environment.\n\n### Starting via CLI\n\nTo get started locally, run one of the following commands:\n\n```bash\nnpm create cloudflare@latest\n# or\npnpm create cloudflare@latest\n# or\nyarn create cloudflare@latest\n```\n\nFor more information on getting started with our CLI, check out the [getting started guide](https://developers.cloudflare.com/workers/get-started/guide/).\n\n### Additional Resources\n\nQuestions about Workers? Join the [official Cloudflare Discord](https://workers.community/) or check out the [Workers docs](https://developers.cloudflare.com/workers/)!\n\n## End-to-End Testing\n\nThis repository includes a comprehensive Playwright-based E2E test suite that validates all templates to ensure they work correctly. The test system supports both **local development mode** (spinning up dev servers) and **live mode** (testing against deployed templates).\n\n### Running E2E Tests\n\n#### Local Development Mode (Default)\n\nBy default, tests run against locally started development servers:\n\n```bash\n# Run all E2E tests\npnpm run test:e2e\n\n# Run tests for specific templates\npnpm run test:e2e astro-blog-starter-template.spec.ts\npnpm run test:e2e saas-admin-template.spec.ts\n\n# Run tests with UI mode for debugging\npnpm run test:e2e --ui\n```\n\nIn local mode:\n\n- Tests start development servers automatically for each template\n- Uses one worker to prevent port conflicts\n- Servers are properly cleaned up between different template tests\n- Longer timeouts to account for build and startup time\n\n#### Live Mode (Testing Deployed Templates)\n\nTo test against live deployed templates, set the `PLAYWRIGHT_USE_LIVE` environment variable:\n\n```bash\n# Run tests against live deployed templates\npnpm run test:e2e:live\n\n# Run specific template tests in live mode\npnpm run test:e2e:live saas-admin-template.spec.ts\n```\n\nIn live mode:\n\n- Tests run against `https://{template-name}.templates.workers.dev`\n- Enables parallel execution (up to 4 workers locally, 2 in CI)\n- Faster execution since no local server startup required\n- Shorter timeouts since templates are already running\n\n### Test Architecture\n\nThe test system includes:\n\n- **Automatic template discovery**: Finds all `*-template` directories and analyzes their framework\n- **Smart server management**: Detects framework type (Astro, Next.js, Vite, etc.) and uses appropriate ports\n- **Reliable cleanup**: Properly terminates process trees between test runs\n- **Flexible URL resolution**: Automatically determines live URLs from `wrangler.json` configuration\n\n### Writing Template Tests\n\nTemplate tests should be named `{template-name}.spec.ts` and placed in the `playwright-tests/` directory:\n\n```typescript\nimport { test, expect } from \"./fixtures\";\n\ntest.describe(\"My Template\", () =\u003e {\n\ttest(\"should render correctly\", async ({ page, templateUrl }) =\u003e {\n\t\tawait page.goto(templateUrl);\n\t\tawait expect(page.getByRole(\"heading\", { name: \"Welcome\" })).toBeVisible();\n\t});\n});\n```\n\nThe `templateUrl` fixture automatically provides the correct URL (local dev server or live deployment) based on the test mode.\n\n#### Playwright Codegen\n\nPlaywright includes a test code generation utility that records your actions in a chromium browswer. To start the codegen utility run\n\n```bash\npnpm playwright codgen\n```\n\n## Contributing\n\nWe welcome template contributions! If there's a Workers template you think would be valuable, please read our [contributing guide](./CONTRIBUTING.md) and open an issue or pull request.\n","funding_links":[],"categories":["Workers","JavaScript","Templates \u0026 Examples","\u003ca name=\"TypeScript\"\u003e\u003c/a\u003eTypeScript"],"sub_categories":["Recipes","Starter Templates"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Ftemplates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Ftemplates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Ftemplates/lists"}