{"id":31532609,"url":"https://github.com/alwalxed/hono-openapi-template","last_synced_at":"2026-04-11T10:37:15.269Z","repository":{"id":317944906,"uuid":"1065002602","full_name":"alwalxed/hono-openapi-template","owner":"alwalxed","description":"Type-safe, production-ready Cloudflare Workers boilerplate with Hono, Zod, Drizzle ORM, D1, and OpenAPI.","archived":false,"fork":false,"pushed_at":"2025-09-26T23:38:37.000Z","size":375,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T04:00:04.188Z","etag":null,"topics":["bolierplate","cloudflare","cloudflare-workers","d1-database","drizzle-orm","hono","honojs","open-source","openapi","rest-api","scalar-docs","sqlite","type-safe","typescript","zod","zod-validation"],"latest_commit_sha":null,"homepage":"","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/alwalxed.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":null,"security":"SECURITY.md","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":"2025-09-26T22:33:41.000Z","updated_at":"2025-09-29T14:58:23.000Z","dependencies_parsed_at":"2025-10-04T04:10:27.639Z","dependency_job_id":null,"html_url":"https://github.com/alwalxed/hono-openapi-template","commit_stats":null,"previous_names":["alwalxed/hono-openapi-template"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/alwalxed/hono-openapi-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwalxed%2Fhono-openapi-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwalxed%2Fhono-openapi-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwalxed%2Fhono-openapi-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwalxed%2Fhono-openapi-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alwalxed","download_url":"https://codeload.github.com/alwalxed/hono-openapi-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alwalxed%2Fhono-openapi-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31677819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T08:18:19.405Z","status":"ssl_error","status_checked_at":"2026-04-11T08:17:08.892Z","response_time":54,"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":["bolierplate","cloudflare","cloudflare-workers","d1-database","drizzle-orm","hono","honojs","open-source","openapi","rest-api","scalar-docs","sqlite","type-safe","typescript","zod","zod-validation"],"created_at":"2025-10-04T03:56:39.524Z","updated_at":"2026-04-11T10:37:15.246Z","avatar_url":"https://github.com/alwalxed.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hono OpenAPI Template\n\nType-safe, production-ready Cloudflare Workers boilerplate with Hono, Zod, Drizzle ORM, D1, and OpenAPI.\n\n\u003cdiv align=\"left\"\u003e\n  \u003c!-- Core Language/Runtime --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge\u0026logo=typescript\u0026logoColor=white\" alt=\"TypeScript\" /\u003e\n  \u003c!-- Framework/Server --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Hono-E36002?style=for-the-badge\u0026logo=hono\u0026logoColor=white\" alt=\"Hono\" /\u003e\n  \u003c!-- Platform/Infrastructure --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Cloudflare-F38020?style=for-the-badge\u0026logo=cloudflare\u0026logoColor=white\" alt=\"Cloudflare\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Cloudflare_D1-F38020?style=for-the-badge\u0026logo=cloudflare\u0026logoColor=white\" alt=\"Cloudflare D1\" /\u003e\n  \u003c!-- Database/ORM --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/SQLite-07405E?style=for-the-badge\u0026logo=sqlite\u0026logoColor=white\" alt=\"SQLite\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Drizzle-22D3EE?style=for-the-badge\u0026logo=drizzle\u0026logoColor=white\" alt=\"Drizzle ORM\" /\u003e\n  \u003c!-- API/Schema --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/OpenAPI-6BA539?style=for-the-badge\u0026logo=openapi-initiative\u0026logoColor=white\" alt=\"OpenAPI\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Zod-7C3AED?style=for-the-badge\u0026logo=zod\u0026logoColor=white\" alt=\"Zod\" /\u003e\n  \u003c!-- Documentation/UI --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Scalar_UI-F97316?style=for-the-badge\u0026logoColor=white\" alt=\"Scalar UI\" /\u003e\n  \u003c!-- Logging --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Pino-EC4899?style=for-the-badge\u0026logoColor=white\" alt=\"Pino\" /\u003e\n  \u003c!-- Development Tools --\u003e\n  \u003cimg src=\"https://img.shields.io/badge/ESLint-4B32C3?style=for-the-badge\u0026logo=eslint\u0026logoColor=white\" alt=\"ESLint\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Prettier-F7B93E?style=for-the-badge\u0026logo=prettier\u0026logoColor=white\" alt=\"Prettier\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Knip-10B981?style=for-the-badge\u0026logoColor=white\" alt=\"Knip\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Husky-111827?style=for-the-badge\u0026logoColor=white\" alt=\"Husky\" /\u003e\n\u003c/div\u003e\n\n## Features\n\n- **Modern Stack**: Built with Hono, TypeScript, and Cloudflare Workers\n- **Type Safety**: Full TypeScript support with Zod schema validation\n- **API Documentation**: Auto-generated OpenAPI specs \u0026 Scalar UI\n- **Database**: Drizzle ORM \u0026 Cloudflare D1 integration\n- **Developer Experience**: Linting, formatting, and git hooks\n\n## Table of Contents\n\n- [Tech Stack](#tech-stack)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Development](#development)\n- [Available Scripts](#available-scripts)\n- [Screenshots](#screenshots)\n- [Deployment](#deployment)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Tech Stack\n\n| Component             | Technology                  |\n| --------------------- | --------------------------- |\n| **Runtime**           | Cloudflare Workers          |\n| **Framework**         | Hono                        |\n| **Language**          | TypeScript                  |\n| **Validation**        | Zod                         |\n| **Database**          | Drizzle ORM + Cloudflare D1 |\n| **API Documentation** | OpenAPI + Scalar UI         |\n| **Package Manager**   | pnpm                        |\n\n## Prerequisites\n\nBefore getting started, ensure you have the following installed:\n\n- **Node.js** 18.x or higher\n- **pnpm** package manager\n- **Cloudflare account** with Workers and D1 access\n\n## Installation\n\n1. **Clone and install dependencies:**\n\n   ```bash\n   git clone https://github.com/alwalxed/hono-openapi-template.git\n   cd hono-openapi-template\n   pnpm install\n   ```\n\n2. **Set up environment configuration:**\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Update the `.env` file with your specific configuration values.\n\n## Configuration\n\n### Database Setup\n\n1. **Create a new D1 database:**\n\n   ```bash\n   npx wrangler d1 create demo\n   ```\n\n2. **Update configuration files:**\n\n   Add the returned database ID to `wrangler.jsonc`:\n\n   ```json\n   {\n     \"database_id\": \"your-database-id-here\"\n   }\n   ```\n\n3. **Generate TypeScript definitions:**\n\n   ```bash\n   pnpm run cf-typegen\n   ```\n\n4. **Configure Drizzle:**\n\n   Update `drizzle.config.ts` with your database ID.\n\n### Environment Variables\n\nConfigure the following environment variables in your `.env` file:\n\n| Variable                | Description                | Example              |\n| ----------------------- | -------------------------- | -------------------- |\n| `NODE_ENV`              | Application environment    | `development`        |\n| `JWT_SECRET`            | JWT signing secret         | Generate with crypto |\n| `LOG_LEVEL`             | Logging verbosity          | `debug`              |\n| `CLOUDFLARE_ACCOUNT_ID` | Your Cloudflare account ID |                      |\n| `CLOUDFLARE_D1_TOKEN`   | D1 database access token   |                      |\n\n\u003e **Security Note**: Generate a secure JWT secret using:\n\u003e\n\u003e ```bash\n\u003e node -e \"console.log(require('crypto').randomBytes(32).toString('hex'))\"\n\u003e ```\n\n## Development\n\n### Local Database Setup\n\n1. **Initialize local database:**\n\n   ```bash\n   pnpm run db:reset:local\n   pnpm run db:generate:local\n   pnpm run db:migrate:local\n   ```\n\n2. **Configure local database path:**\n\n   Find your SQLite database path:\n\n   ```bash\n   find ./.wrangler/state/v3/d1/miniflare-D1DatabaseObject -name \"*.sqlite\"\n   ```\n\n   Update `drizzle.local.config.ts` with the returned path.\n\n3. **Seed the database:**\n\n   ```bash\n   pnpm run db:seed:local\n   ```\n\n### Start Development Server\n\n```bash\npnpm run dev\n```\n\nThe development server will start with hot reload enabled. Your API documentation will be available at the `/docs` endpoint.\n\n### Optional: Git Hooks Setup\n\nEnable automated code quality checks:\n\n```bash\npnpm run prepare\n```\n\nCreate `.husky/pre-commit`:\n\n```bash\n#!/usr/bin/env sh\nNVM_DIR=\"${NVM_DIR:-$HOME/.nvm}\"\n[ -s \"$NVM_DIR/nvm.sh\" ] \u0026\u0026 \\. \"$NVM_DIR/nvm.sh\"\nnpx lint-staged\n```\n\n## Available Scripts\n\n### Development Commands\n\n| Command           | Description                                |\n| ----------------- | ------------------------------------------ |\n| `pnpm dev`        | Start development server with hot reload   |\n| `pnpm build`      | Build for production                       |\n| `pnpm deploy`     | Deploy to Cloudflare Workers               |\n| `pnpm cf-typegen` | Generate Cloudflare TypeScript definitions |\n\n### Code Quality Commands\n\n| Command             | Description                          |\n| ------------------- | ------------------------------------ |\n| `pnpm lint`         | Lint TypeScript and JavaScript files |\n| `pnpm lint:fix`     | Automatically fix linting issues     |\n| `pnpm format`       | Format code using Prettier           |\n| `pnpm format:check` | Check code formatting                |\n| `pnpm knip`         | Detect unused dependencies           |\n\n### Database Management\n\n#### Local Database Commands\n\n| Command                      | Description                            |\n| ---------------------------- | -------------------------------------- |\n| `pnpm run db:generate:local` | Generate database migrations           |\n| `pnpm run db:migrate:local`  | Apply migrations to local database     |\n| `pnpm run db:seed:local`     | Seed local database with sample data   |\n| `pnpm run db:dump:local`     | View all local database data           |\n| `pnpm run db:reset:local`    | Reset and recreate local database      |\n| `pnpm run db:studio:local`   | Open Drizzle Studio for local database |\n| `pnpm run db:inspect:local`  | Inspect local database schema          |\n\n#### Production Database Commands\n\n| Command                    | Description                             |\n| -------------------------- | --------------------------------------- |\n| `pnpm run db:migrate:prod` | Apply migrations to production database |\n| `pnpm run db:studio`       | Open Drizzle Studio for remote database |\n| `pnpm run db:inspect:prod` | Inspect production database schema      |\n\n## Screenshots\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./screenshot_1.png\" alt=\"API Overview\" width=\"100%\" /\u003e\n  \u003cimg src=\"./screenshot_2.png\" alt=\"Database Studio\" width=\"100%\" /\u003e\n\u003c/p\u003e\n\n## Deployment\n\n### Production Environment Setup\n\nBefore deploying, configure your production environment variables:\n\n```bash\nnpx wrangler secret put NODE_ENV\nnpx wrangler secret put JWT_SECRET\nnpx wrangler secret put LOG_LEVEL\nnpx wrangler secret put CLOUDFLARE_ACCOUNT_ID\nnpx wrangler secret put CLOUDFLARE_D1_TOKEN\n```\n\n### Deploy to Production\n\n```bash\npnpm run deploy\n```\n\nThis command will build and deploy your application to Cloudflare Workers with optimizations enabled.\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.\n\n## License\n\nThis project is licensed under the [MIT](./LICENSE) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwalxed%2Fhono-openapi-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falwalxed%2Fhono-openapi-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwalxed%2Fhono-openapi-template/lists"}