{"id":13800336,"url":"https://github.com/kriasoft/cloudflare-starter-kit","last_synced_at":"2025-07-01T22:04:14.476Z","repository":{"id":37008981,"uuid":"380359842","full_name":"kriasoft/cloudflare-starter-kit","owner":"kriasoft","description":"Template (boilerplate) repository for scaffolding Cloudflare Workers projects","archived":false,"fork":false,"pushed_at":"2023-02-19T19:57:33.000Z","size":5862,"stargazers_count":129,"open_issues_count":1,"forks_count":21,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-19T20:14:52.893Z","etag":null,"topics":["boilerplate","cdn","cloudflare","cloudflare-workers","edge","edge-computing","firebase","firebase-auth","front-end","frontend","gcp","hachathon","jamstack","miniflare","scaffolding","starter-kit","template","typescript","vite","webworker"],"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/kriasoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"kriasoft","patreon":"koistya","open_collective":"react-starter-kit"}},"created_at":"2021-06-25T21:43:13.000Z","updated_at":"2025-06-14T18:17:10.000Z","dependencies_parsed_at":"2023-01-16T15:01:33.582Z","dependency_job_id":"4f9a035d-42e3-43ae-8ce8-dc984feb98e9","html_url":"https://github.com/kriasoft/cloudflare-starter-kit","commit_stats":{"total_commits":45,"total_committers":2,"mean_commits":22.5,"dds":0.1333333333333333,"last_synced_commit":"c51a50cabe15eec1194895764f8889e4b537d9b1"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/kriasoft/cloudflare-starter-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fcloudflare-starter-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fcloudflare-starter-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fcloudflare-starter-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fcloudflare-starter-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kriasoft","download_url":"https://codeload.github.com/kriasoft/cloudflare-starter-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kriasoft%2Fcloudflare-starter-kit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262708669,"owners_count":23351628,"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":["boilerplate","cdn","cloudflare","cloudflare-workers","edge","edge-computing","firebase","firebase-auth","front-end","frontend","gcp","hachathon","jamstack","miniflare","scaffolding","starter-kit","template","typescript","vite","webworker"],"created_at":"2024-08-04T00:01:11.518Z","updated_at":"2025-07-01T22:04:14.442Z","avatar_url":"https://github.com/kriasoft.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kriasoft","https://patreon.com/koistya","https://opencollective.com/react-starter-kit","http://patreon.com/koistya","https://img.shields.io/badge/dynamic/json?color=%23ff424d\u0026label=Patreon\u0026style=flat-square\u0026query=data.attributes.patron_count\u0026suffix=%20patrons\u0026url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F233228"],"categories":["Workers"],"sub_categories":["Recipes"],"readme":"# Cloudflare Workers Starter Kit\n\n\u003ca href=\"http://www.typescriptlang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg?style=flat-square\" height=\"20\"\u003e\u003c/a\u003e\n\u003ca href=\"http://patreon.com/koistya\"\u003e\u003cimg src=\"https://img.shields.io/badge/dynamic/json?color=%23ff424d\u0026label=Patreon\u0026style=flat-square\u0026query=data.attributes.patron_count\u0026suffix=%20patrons\u0026url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F233228\" height=\"20\"\u003e\u003c/a\u003e\n\u003ca href=\"https://discord.gg/QEd934tZvR\"\u003e\u003cimg src=\"https://img.shields.io/discord/643523529131950086?label=Chat\u0026style=flat-square\" height=\"20\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/kriasoft/cloudflare-starter-kit/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/kriasoft/cloudflare-starter-kit.svg?style=social\u0026label=Star\u0026maxAge=3600\" height=\"20\"\u003e\u003c/a\u003e\n\u003ca href=\"https://twitter.com/koistya\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/koistya.svg?style=social\u0026label=Follow\u0026maxAge=3600\" height=\"20\"\u003e\u003c/a\u003e\n\nProject template for [scaffolding](https://github.com/kriasoft/cloudflare-starter-kit/generate)\n[Cloudflare Workers](https://workers.cloudflare.com/) projects.\n\n## Features\n\n- Supports [multiple CF Workers](https://miniflare.dev/core/mount) within the same (mono)repo; using ES modules syntax\n- Pre-configured with [TypeScript](https://typescriptlang.org/), [Babel](https://babeljs.io/),\n  [Rollup](https://rollupjs.org/), [ESLint](https://eslint.org/), [Vitest](https://vitest.dev/),\n  [Prettier](https://prettier.io/), [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/),\n  [Miniflare](https://miniflare.dev/)\n- Pre-configured with `local`, `test` (staging/QA), and `prod` (production) environments\n- Pre-configured with local testing and debugging; loading environment variables from `*.env` files\n- [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) usage example for integrating with 3rd party services (Google Cloud, etc.)\n- Code snippets and other VSCode settings; CI/CD workflows with GitHub Actions\n\n---\n\nThis project was bootstrapped with [Cloudflare Starter Kit](https://github.com/kriasoft/cloudflare-starter-kit).\nBe sure to join our [Discord channel](https://discord.gg/QEd934tZvR) for assistance.\n\n## Directory Structure\n\n`├──`[`.github/workflows`](./.github/workflows/) — CI/CD workflows powered by [GitHub Actions](https://github.com/features/actions)\u003cbr\u003e\n`├──`[`.vscode`](.vscode) — [VSCode](https://code.visualstudio.com/) settings including code snippets, recommended extensions etc.\u003cbr\u003e\n`├──`[`api`](./api) — Cloudflare Worker script for handling API requests\u003cbr\u003e\n`├──`[`app`](./app) — Web application front-end powered by [Vite](https://vitejs.dev/) and [React.js](https://reactjs.org/)\u003cbr\u003e\n`├──`[`edge`](./edge) — [Cloudflare Workers](https://workers.cloudflare.com/) script for serving static websites (reverse proxy)\u003cbr\u003e\n`├──`[`scripts`](./scripts) — Automation scripts, such as `yarn deploy`\u003cbr\u003e\n`├──`[`package.json`](./project.json) — The list of [NPM](https://www.npmjs.com/) dependencies and [Yarn](https://yarnpkg.com/) workspaces\u003cbr\u003e\n`└──`[`tsconfig.base.json`](./tsconfig.base.json) — [TypeScript](https://www.typescriptlang.org/) configuration shared across packages/workspaces\u003cbr\u003e\n\n## Tech Stack\n\n- [TypeScript](https://www.typescriptlang.org/), [Cloudflare Workers](https://workers.cloudflare.com/),\n  [Hono](https://honojs.dev/)\n- [Vite](https://vitejs.dev/), [Rollup](https://rollupjs.org/),\n  [Miniflare](https://miniflare.dev/), [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/),\n  [ESLint](https://eslint.org/), [Prettier](https://prettier.io/),\n  [Vitest](https://vitest.dev/), [Yarn](https://yarnpkg.com/) with PnP\n\n## Requirements\n\n- [Node.js](https://nodejs.org/) v18+ with [Corepack](https://nodejs.org/api/corepack.html) (`$ corepack enable`)\n- [VS Code](https://code.visualstudio.com/) editor with [recommended extensions](.vscode/extensions.json)\n\n## Getting Started\n\n[Generate a new repository](https://github.com/kriasoft/cloudflare-starter-kit/generate)\nfrom this template, clone, install dependencies, open it in VSCode and start hacking:\n\n```bash\n$ git clone https://github.com/kriasoft/cloudflare-starter-kit.git\n$ cd ./cloudflare-starter-kit\n$ yarn install\n$ yarn start\n$ yarn test\n```\n\nFind the worker scripts inside of the [`./edge`](./edge/) and [`./api`](./api/) folders.\n\n**IMPORTANT**: Ensure that VSCode is using the [workspace version of TypeScript](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions).\n\n## Scripts\n\n- **`yarn start`** - Launches web application on [`http://localhost:5173/`](http://localhost:5173/)\n- **`yarn lint`** — Validates the code using [ESLint](https://eslint.org/)\n- **`yarn tsc`** — Validates the code using [TypeScript](https://www.typescriptlang.org/) compiler\n- **`yarn test`** — Runs unit tests with [Vitest](https://vitest.dev/), [Miniflare](https://miniflare.dev/), and [Supertest](https://github.com/visionmedia/supertest)\n- **`yarn build`** — Compiles and bundles worker scripts into the `./dist` folder(s)\n- **`yarn deploy`** — Deploys the app to [Cloudflare Workers](https://developers.cloudflare.com/workers/) / [GCF](https://cloud.google.com/functions)\n\n## How to Create a CF Worker\n\nFind below the minimal boilerplate for creating a new CF Worker script using TypeScript with ESM syntax:\n\n#### `example/index.ts` — CF Worker script\n\n```ts\nimport { Hono } from \"hono\";\n\nconst app = new Hono\u003cEnv\u003e();\n\napp.get(\"/\", ({ text }) =\u003e {\n  return text(\"Hello world!\", 200);\n});\n\nexport default app;\n```\n\n#### `example/index.test.ts` — unit test powered by Miniflare\n\n```ts\nimport { expect, test } from \"vitest\";\nimport app from \"./index.js\";\n\ntest(\"GET /\", async () =\u003e {\n  const req = new Request(`https://${env.APP_HOSTNAME}/`);\n  const res = await app.fetch(req, bindings);\n  const body = await res.text();\n\n  expect({ status: res.status, body }).toEqual({\n    status: 200,\n    body: \"Hello world!\",\n  });\n});\n```\n\n#### `example/wrangler.toml` — deployment configuration\n\n```toml\nname = \"example\"\nmain = \"index.js\"\ncompatibility_date = \"2022-04-18\"\naccount_id = \"$CLOUDFLARE_ACCOUNT_ID\"\nroute = \"$APP_HOSTNAME/*\"\n\n[vars]\nAPP_ENV = \"$APP_ENV\"\nAPP_HOSTNAME = \"$APP_HOSTNAME\"\n\n[[rules]]\ntype = \"ESModule\"\nglobs = [\"**/*.js\"]\n```\n\nPlus [`package.json`](./edge/package.json), [`tsconfig.json`](./edge/tsconfig.json),\nand [`global.d.ts`](./edge/global.d.ts) files configuring TypeScript for the workspace.\n\nNote that `$APP_HOSTNAME` and `$CLOUDFLARE_ACCOUNT_ID` placeholders in the\nexample above will be automatically replaced with values from [`*.env`](./env/)\nfiles for the target environment during local testing or deployment.\n\nFor more sophisticated examples visit [Cloudflare Workers Examples](https://developers.cloudflare.com/workers/examples/) directory.\n\n## How to Deploy\n\nThe deployments are handled automatically by [GitHub Actions](https://github.com/features/actions)\n(see [`.github/workflows`](.github/workflows/)) whenever a new commit lands onto\none of these branches:\n\n- **`main`** — Deploys the app to [`https://test.example.com`](https://test.example.com/) (test/QA)\n- **`release`** — Deploys the app to [`https://example.com`](https://example.com/) (production)\n\nAlternatively, you can deploy the app manually by ensuring the all the\nrequired environment variables found in the [`*.env`](./env/) files are\nup-to-date (e.g. `CLOUDFLARE_API_TOKEN`), then running `yarn deploy [--env #0]`,\nspecifying the target deployment area via `--env` flag, e.g. `--env=test`\n(default) or `--env=prod`.\n\nYou can also deploy packages (workspaces) individually, for example:\n\n```bash\n$ yarn api:deploy --env=prod\n$ yarn edge:deploy --env=prod\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://files.tarkus.me/cloudflare-workers-deploy.svg\" /\u003e\u003c/p\u003e\n\n## How to View Logs\n\n```\n$ yarn workspace api wrangler tail [--env #0]\n$ yarn workspace api wrangler tail [--env #0]\n```\n\n## How to Update\n\n- `yarn set version stable` — Bump Yarn to the latest version\n- `yarn upgrade-interactive` — Update Node.js modules (dependencies)\n- `yarn dlx @yarnpkg/sdks vscode` — Update TypeScript, ESLint, and Prettier settings in VSCode\n\n## Backers 💰\n\n\u003ca href=\"https://reactstarter.com/b/1\"\u003e\u003cimg src=\"https://reactstarter.com/b/1.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/2\"\u003e\u003cimg src=\"https://reactstarter.com/b/2.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/3\"\u003e\u003cimg src=\"https://reactstarter.com/b/3.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/4\"\u003e\u003cimg src=\"https://reactstarter.com/b/4.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/5\"\u003e\u003cimg src=\"https://reactstarter.com/b/5.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/6\"\u003e\u003cimg src=\"https://reactstarter.com/b/6.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/7\"\u003e\u003cimg src=\"https://reactstarter.com/b/7.png\" height=\"60\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://reactstarter.com/b/8\"\u003e\u003cimg src=\"https://reactstarter.com/b/8.png\" height=\"60\" /\u003e\u003c/a\u003e\n\n## Related Projects\n\n- [React Starter Kit](https://github.com/kriasoft/react-starter-kit) — front-end template for React and Relay using Jamstack architecture\n- [Node.js API Starter Kit](https://github.com/kriasoft/node-starter-kit) — project template, pre-configured with Node.js, GraphQL, and PostgreSQL\n- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter) — monorepo template, pre-configured with GraphQL API, React, and Relay\n\n## How to Contribute\n\nAnyone and everyone is welcome to [contribute](.github/CONTRIBUTING.md). Start\nby checking out the list of [open issues](https://github.com/kriasoft/cloudflare-starter-kit/issues)\nmarked [help wanted](https://github.com/kriasoft/cloudflare-starter-kit/issues?q=label:\"help+wanted\").\nHowever, if you decide to get involved, please take a moment to review the\n[guidelines](.github/CONTRIBUTING.md).\n\n## License\n\nCopyright © 2020-present Kriasoft. This source code is licensed under the MIT license found in the\n[LICENSE](https://github.com/kriasoft/cloudflare-starter-kit/blob/main/LICENSE) file.\n\n---\n\n\u003csup\u003eMade with ♥ by Konstantin Tarkus ([@koistya](https://twitter.com/koistya), [blog](https://medium.com/@koistya))\nand [contributors](https://github.com/kriasoft/cloudflare-starter-kit/graphs/contributors).\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkriasoft%2Fcloudflare-starter-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkriasoft%2Fcloudflare-starter-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkriasoft%2Fcloudflare-starter-kit/lists"}