{"id":24191193,"url":"https://github.com/easydevv/cloudflare-hono-vitest","last_synced_at":"2026-05-06T14:37:29.472Z","repository":{"id":272242021,"uuid":"915937597","full_name":"EasyDevv/cloudflare-hono-vitest","owner":"EasyDevv","description":"A simple Hono application demonstrating deployment on Cloudflare Workers, complete with tests using Vitest. Exposes an endpoint returning environment variables in JSON format.","archived":false,"fork":false,"pushed_at":"2025-01-18T09:00:24.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T04:13:19.935Z","etag":null,"topics":["api","cloudflare-workers","hono","javascript","serverless","typescript","vitest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/EasyDevv.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-13T06:21:11.000Z","updated_at":"2025-01-18T09:00:25.000Z","dependencies_parsed_at":"2025-01-13T07:29:19.306Z","dependency_job_id":"8068b61a-0a1d-41b6-8520-29833db34db3","html_url":"https://github.com/EasyDevv/cloudflare-hono-vitest","commit_stats":null,"previous_names":["easydevv/cloudflare-hono-vitest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyDevv%2Fcloudflare-hono-vitest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyDevv%2Fcloudflare-hono-vitest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyDevv%2Fcloudflare-hono-vitest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EasyDevv%2Fcloudflare-hono-vitest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EasyDevv","download_url":"https://codeload.github.com/EasyDevv/cloudflare-hono-vitest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241605819,"owners_count":19989612,"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":["api","cloudflare-workers","hono","javascript","serverless","typescript","vitest"],"created_at":"2025-01-13T15:17:37.125Z","updated_at":"2026-05-06T14:37:29.437Z","avatar_url":"https://github.com/EasyDevv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Workers Hono Vitest Template\n\n\u003ch3 align=\"center\"\u003eBuild and Test Serverless Apps Quickly.\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg\n    src=\"https://go-skill-icons.vercel.app/api/icons?i=cloudflare,hono,vite,bun\"\n    /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"./README.md\"\u003e\u003cimg alt=\"README in English\" src=\"https://img.shields.io/badge/English-d9d9d9\"\u003e\u003c/a\u003e\n    \u003ca href=\"./README_KR.md\"\u003e\u003cimg alt=\"README in Korean\" src=\"https://img.shields.io/badge/Korean-d9d9d9\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis template provides an example of testing a Hono app running on Cloudflare Workers using Vitest. It includes a simple example code that outputs environment variables as JSON, and demonstrates how to manage important API keys for local development.\n\n## Prerequisites\n\nBefore getting started, ensure you have the following:\n\n- [Bun](https://bun.sh/)\n- [Cloudflare Account](https://dash.cloudflare.com/)\n\n## Project Structure\n\n- `src/index.ts`: Main Hono file.\n- `test/index.test.ts`: Vitest test cases.\n- `.dev.vars`: File to define environment variables and secrets for local development.\n- `wrangler.toml`: Cloudflare Workers configuration file.\n\n## Setup\n\n### 1. Create a New Project:\n\nReplace `my-project` with your desired project name. If not provided, the project will be named `cloudflare-hono-vitest`.\n\n```bash\nbun create easydevv/cloudflare-hono-vitest my-project\n# bun create `template` `project-name`\n```\n\n### 2. Configure `wrangler.toml`:\n\nHere’s an example configuration for `wrangler.toml`:\n\n```toml\nname = \"my-project\"\nmain = \"src/index.ts\"\n\n[vars]\nMY_VARIABLE = \"your_variable\"\n```\n\n### 3. Set Up Environment Variables (Optional):\n\nCreate a `.dev.vars` file in the project root. This file is automatically loaded by Wrangler when running the application locally.\n\nExample `.dev.vars`:\n\n```plaintext\nMY_SECRET=\"your_secret\"\n```\n\nThese variables can be accessed in the Hono application via `c.env`.\n\n## Running the Application\n\nTo run the application locally using Wrangler:\n\n```bash\nbun run dev # or bun dev\n```\n\nThis command starts a local server accessible at `http://localhost:8787`.\n\n## Running Tests\n\nTo run tests using Bun:\n\n```bash\nbun run test\n```\n\nAlternatively, using bunx:\n\n```bash\nbunx vitest\n```\n\n## Production Setup\n\n#### 1. Set Up SECRET in Cloudflare Workers:\n\nUse the Wrangler CLI to set secrets for your application:\n\n```bash\nwrangler secret put MY_SECRET\n```\n\nYou will be prompted to enter the value for `MY_SECRET`. Input your API key or other sensitive data.\n\n#### 2. Deploy the Application:\n\nDeploy the Hono application to Cloudflare Workers using the following command:\n\n```bash\nbun run deploy\n```\n\nAfter deployment, you can monitor it in the Cloudflare dashboard:\n\n- [Cloudflare Dashboard](https://dash.cloudflare.com/)\n\n## Conclusion\n\nFor more information on Hono, Cloudflare Workers, and Vitest, refer to their official documentation:\n\n- [Hono Documentation](https://hono.dev/docs/getting-started/cloudflare-workers)\n- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)\n- [Vitest Documentation](https://vitest.dev/guide/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasydevv%2Fcloudflare-hono-vitest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasydevv%2Fcloudflare-hono-vitest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasydevv%2Fcloudflare-hono-vitest/lists"}