{"id":15679160,"url":"https://github.com/msutkowski/ts-rest-hono","last_synced_at":"2025-08-12T21:18:55.306Z","repository":{"id":151677345,"uuid":"618230041","full_name":"msutkowski/ts-rest-hono","owner":"msutkowski","description":"A hono adapter for ts-rest","archived":false,"fork":false,"pushed_at":"2023-11-25T01:27:04.000Z","size":139,"stargazers_count":51,"open_issues_count":5,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-08T22:09:25.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/msutkowski.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2023-03-24T02:39:08.000Z","updated_at":"2025-08-01T09:52:25.000Z","dependencies_parsed_at":"2025-05-06T21:00:41.619Z","dependency_job_id":null,"html_url":"https://github.com/msutkowski/ts-rest-hono","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/msutkowski/ts-rest-hono","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msutkowski%2Fts-rest-hono","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msutkowski%2Fts-rest-hono/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msutkowski%2Fts-rest-hono/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msutkowski%2Fts-rest-hono/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msutkowski","download_url":"https://codeload.github.com/msutkowski/ts-rest-hono/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msutkowski%2Fts-rest-hono/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270135719,"owners_count":24533341,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-03T16:26:33.086Z","updated_at":"2025-08-12T21:18:55.247Z","avatar_url":"https://github.com/msutkowski.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-rest-hono\n\n\u003cp align=\"center\"\u003e🔥 A \u003ca href=\"https://hono.dev/\"\u003ehono\u003c/a\u003e adapter for \u003ca href=\"https://www.ts-rest.com\"\u003ets-rest 🔥\u003c/a\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.ts-rest.com\"\u003e\n    \u003cimg src=\"https://avatars.githubusercontent.com/u/109956939?s=400\u0026u=8bf67b1281da46d64eab85f48255cd1892bf0885\u0026v=4\" height=\"150\"\u003e\u003c/img\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://hono.dev\"\u003e\n    \u003cimg src=\"https://avatars.githubusercontent.com/u/98495527?s=400\u0026v=4\" height=\"150\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eIncrementally adoptable RPC-like client and server helpers for a magical end to end typed experience + The small, simple, and ultrafast web framework for the Edges.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/ts-rest-hono\"\u003e\n    \u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/msutkowski/ts-rest-hono\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/ts-rest-hono\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/ts-rest-hono\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/ts-rest-hono\"\u003e\n    \u003cimg alt=\"Bundle Size\" src=\"https://img.shields.io/bundlephobia/minzip/ts-rest-hono?label=ts-rest-hono\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n### Set it up in 3 Steps!\n\n#### 1. Define your Contract.\n\n```typescript\n// contract.ts\nimport { initContract } from \"@ts-rest/core\";\nimport { z } from \"zod\";\n\nconst c = initContract();\n\nexport const TodoSchema = z.object({\n  id: z.string(),\n  title: z.string(),\n  completed: z.boolean(),\n});\n\nexport const contract = c.router({\n  getTodos: {\n    method: \"GET\",\n    path: \"/todos\",\n    responses: {\n      201: TodoSchema.array(),\n    },\n    summary: \"Create \",\n  },\n  createTodo: {\n    method: \"POST\",\n    path: \"/todo\",\n    responses: {\n      201: TodoSchema,\n    },\n    body: z.object({\n      title: z.string(),\n      completed: z.boolean(),\n    }),\n    summary: \"Creates a todo.\",\n  },\n});\n```\n\n#### 2. Initialize Server Router.\n\n```ts\n// router.ts\nimport { initServer } from \"ts-rest-hono\";\nimport { contract } from \"./contract\";\nimport { nanoid } from \"nanoid\";\n\nconst s = initServer();\n\ntype Todo = {\n  id: string;\n  title: string;\n  completed: boolean;\n};\n\n// Database\nconst todos: Todo[] = [];\n\nexport const router = s.router(contract, {\n  getTodos: async () =\u003e {\n    return {\n      status: 201,\n      body: todos,\n    };\n  },\n  createTodo: async ({ body: { completed, title } }) =\u003e {\n    const newTodo = {\n      id: nanoid(),\n      title,\n      completed,\n    };\n\n    todos.push(newTodo);\n\n    return {\n      status: 201,\n      body: newTodo,\n    };\n  },\n});\n```\n\n#### 3. Create Endpoints on App.\n\n```ts\n// app.ts\nimport { serve } from \"@hono/node-server\";\nimport { Hono } from \"hono\";\nimport { createHonoEndpoints } from \"ts-rest-hono\";\nimport { contract } from \"./contract\";\nimport { router } from \"./router\";\n\nconst app = new Hono();\n\napp.get(\"/\", (c) =\u003e {\n  return c.text(\"🔥 Hello Hono!\");\n});\n\ncreateHonoEndpoints(contract, router, app);\n\n// Run the server!\ntry {\n  serve(app, (info) =\u003e {\n    console.log(`Listening on http://localhost:${info.port}`);\n  });\n} catch (err) {\n  console.log(err);\n  process.exit(1);\n}\n```\n\n\u003cbr /\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cp align=\"center\"\u003eFinally just run \u003ccode\u003eapp.ts\u003c/code\u003e\u003c/p\u003e\n    \u003cp align=\"center\"\u003eIt's that easy! Enjoy your ultra-fast typesafe API 🔥🚀\u003c/p\u003e\n\u003c/p\u003e\n\nDeno is also supported at [deno_dist](./deno_dist/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsutkowski%2Fts-rest-hono","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsutkowski%2Fts-rest-hono","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsutkowski%2Fts-rest-hono/lists"}