{"id":13455143,"url":"https://github.com/ts-rest/ts-rest","last_synced_at":"2025-05-15T01:03:20.110Z","repository":{"id":49818803,"uuid":"517037664","full_name":"ts-rest/ts-rest","owner":"ts-rest","description":"RPC-like client, contract, and server implementation for a pure REST API","archived":false,"fork":false,"pushed_at":"2025-03-04T09:01:02.000Z","size":9735,"stargazers_count":2782,"open_issues_count":97,"forks_count":149,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-08T00:35:15.480Z","etag":null,"topics":["api","fastify","nestjs","nextjs","openapi","react","react-query","rest","rpc","solid","typescript"],"latest_commit_sha":null,"homepage":"https://ts-rest.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/ts-rest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":"FUNDING.yml","license":null,"code_of_conduct":null,"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},"funding":{"github":["oliverbutler"]}},"created_at":"2022-07-23T11:23:01.000Z","updated_at":"2025-05-07T13:28:00.000Z","dependencies_parsed_at":"2024-01-20T04:29:50.230Z","dependency_job_id":"360b85a3-f935-4d09-b4bb-754c22f5b839","html_url":"https://github.com/ts-rest/ts-rest","commit_stats":{"total_commits":664,"total_committers":70,"mean_commits":9.485714285714286,"dds":0.5602409638554218,"last_synced_commit":"7a634e787874b431f28bb6c863e7df5ac08649a0"},"previous_names":[],"tags_count":1091,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-rest%2Fts-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-rest%2Fts-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-rest%2Fts-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ts-rest%2Fts-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ts-rest","download_url":"https://codeload.github.com/ts-rest/ts-rest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254040,"owners_count":22039792,"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","fastify","nestjs","nextjs","openapi","react","react-query","rest","rpc","solid","typescript"],"created_at":"2024-07-31T08:01:01.721Z","updated_at":"2025-05-15T01:03:20.082Z","avatar_url":"https://github.com/ts-rest.png","language":"TypeScript","funding_links":["https://github.com/sponsors/oliverbutler"],"categories":["APIs and Servers","TypeScript","api","Packages","Solid","Frameworks","**1. Libraries**"],"sub_categories":["ts-rest/ts-rest","APIs"],"readme":"# ts-rest\n\n\u003cp align=\"center\"\u003e\n \u003cimg src=\"https://avatars.githubusercontent.com/u/109956939?s=400\u0026u=8bf67b1281da46d64eab85f48255cd1892bf0885\u0026v=4\" height=\"150\"\u003e\u003c/img\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 🪄\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/ts-rest/ts-rest\"\u003e\n    \u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/ts-rest/ts-rest\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@ts-rest/core\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/%40ts-rest/core\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/ts-rest/ts-rest/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/ts-rest/ts-rest\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/package/@ts-rest/core\"\u003e\n    \u003cimg alt=\"Bundle Size\" src=\"https://img.shields.io/bundlephobia/minzip/@ts-rest/core?label=%40ts-rest%2Fcore\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cdiv\u003eJoin us on Discord for help, feedback, and discussions!\u003c/div\u003e\u003cbr\u003e\u003c/br\u003e\n  \u003ca href=\"https://discord.gg/2Megk85k5a\"\u003e\n    \u003cimg src=\"https://discordapp.com/api/guilds/1055855205960392724/widget.png?style=banner2\" alt=\"Discord Shield\"/\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n# Introduction\n\nts-rest offers a simple way to define a contract for your API, which can be both consumed and implemented by your application, giving you end to end type safety without the hassle or code generation.\n\n### Features\n\n- End-to-end type safety 🛟\n- RPC-like client side API ⚡️\n- Small Bundle Size 📉\n- No Code Generation 🏃‍♀️\n- Zod support for runtime validation 🔒\n- Full optional OpenAPI integration 📝\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch3\u003e👉 Start reading the official \u003ca href=\"https://ts-rest.com/docs/quickstart?utm_source=github\u0026utm_medium=documentation\u0026utm_campaign=readme\"\u003eQuickstart Guide\u003c/a\u003e 👈\u003c/h3\u003e\n\u003c/div\u003e\n\n### Super Simple Example\n\nEasily define your API contract somewhere shared\n\n```typescript\nconst contract = c.router({\n  getPosts: {\n    method: 'GET',\n    path: '/posts',\n    query: z.object({\n      skip: z.number(),\n      take: z.number(),\n    }), // \u003c-- Zod schema\n    responses: {\n      200: c.type\u003cPost[]\u003e(), // \u003c-- OR normal TS types\n    },\n    headers: z.object({\n      'x-pagination-page': z.coerce.number().optional(),\n    }),\n  },\n});\n```\n\nFulfill the contract on your server, with a type-safe router:\n\n```typescript\nconst router = s.router(contract, {\n  getPosts: async ({ params: { id } }) =\u003e {\n    return {\n      status: 200,\n      body: prisma.post.findUnique({ where: { id } }),\n    };\n  },\n});\n```\n\nConsume the api on the client with a RPC-like interface:\n\n```typescript\nconst result = await client.getPosts({\n  headers: { 'x-pagination-page': 1 },\n  query: { skip: 0, take: 10 },\n  // ^-- Fully typed!\n});\n```\n\n## Quickstart\n\nCreate a contract, implement it on your server then consume it in your client. Incrementally adopt, trial it with your team, then get shipping faster.\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch3\u003e👉 Start reading the official \u003ca href=\"https://ts-rest.com/docs/quickstart?utm_source=github\u0026utm_medium=documentation\u0026utm_campaign=readme\"\u003eQuickstart Guide\u003c/a\u003e 👈\u003c/h3\u003e\n\u003c/div\u003e\n\n## Contributors ✨\n\nMASSIVE Thanks to all of these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)), who have helped make ts-rest possible:\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://gabro.la\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1728215?v=4?s=100\" width=\"100px;\" alt=\"Youssef Gaber\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eYoussef Gaber\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=Gabrola\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-Gabrola\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=Gabrola\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/netiperher\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/45091747?v=4?s=100\" width=\"100px;\" alt=\"Per Hermansson\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePer Hermansson\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=netiperher\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=netiperher\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://ghoullier.deno.dev/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/2315749?v=4?s=100\" width=\"100px;\" alt=\"Grégory Houllier\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eGrégory Houllier\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=ghoullier\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://michaelangrivera.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/55844504?v=4?s=100\" width=\"100px;\" alt=\"Michael Angelo \"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMichael Angelo \u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=michaelangrivera\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://pieter.venter.pro\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1845861?v=4?s=100\" width=\"100px;\" alt=\"Pieter Venter\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePieter Venter\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=cyrus-za\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://rifaldhiaw.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/7936061?v=4?s=100\" width=\"100px;\" alt=\"Rifaldhi AW\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRifaldhi AW\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=rifaldhiaw\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/Jwcode-uk\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/30149596?v=4?s=100\" width=\"100px;\" alt=\"Jonathan White \"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJonathan White \u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=Jwcode-uk\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=Jwcode-uk\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/gingermusketeer\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1177034?v=4?s=100\" width=\"100px;\" alt=\"Max Brosnahan\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMax Brosnahan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=gingermusketeer\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-gingermusketeer\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://oliverbutler.uk\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/47489826?v=4?s=100\" width=\"100px;\" alt=\"Oliver Butler\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eOliver Butler\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=oliverbutler\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-oliverbutler\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=oliverbutler\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#infra-oliverbutler\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"#maintenance-oliverbutler\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/baryla\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/10336085?v=4?s=100\" width=\"100px;\" alt=\"Adrian Barylski\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAdrian Barylski\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=baryla\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=baryla\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=baryla\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://nad.dev\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/6670753?v=4?s=100\" width=\"100px;\" alt=\"Neil A. Dobson\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNeil A. Dobson\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=neildobson-au\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/dohaicuong\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/20808725?v=4?s=100\" width=\"100px;\" alt=\"Eric Do\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eEric Do\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=dohaicuong\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/fruchtzwerg\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/15377955?v=4?s=100\" width=\"100px;\" alt=\"Ben\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eBen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=fruchtzwerg\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=fruchtzwerg\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=fruchtzwerg\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://llllvvuu.dev\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/5601392?v=4?s=100\" width=\"100px;\" alt=\"LW\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLW\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=llllvvuu\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/ts-rest/ts-rest/issues?q=author%3Allllvvuu\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/avancealaska\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/72231502?v=4?s=100\" width=\"100px;\" alt=\"Andrew Vance\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAndrew Vance\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/ts-rest/ts-rest/commits?author=avancealaska\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n## Star History\n\nSince our first commit in 2022 we've been growing steadily. We're proud of our progress and we're excited about the future.\n\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://star-history.com/#ts-rest/ts-rest\u0026Timeline\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=ts-rest/ts-rest\u0026type=Timeline\u0026theme=dark\" /\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=ts-rest/ts-rest\u0026type=Timeline\" /\u003e\n    \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=ts-rest/ts-rest\u0026type=Timeline\" /\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\" \u003e\n  \u003cdiv\u003eJoin us on Discord for help, feedback, and discussions!\u003c/div\u003e\u003cbr\u003e\u003c/br\u003e\n  \u003ca href=\"https://discord.gg/2Megk85k5a\"\u003e\n    \u003cimg src=\"https://discordapp.com/api/guilds/1055855205960392724/widget.png?style=banner2\" alt=\"Discord Shield\"/\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv  align=\"center\"\u003e\n  \u003ca\n    href=\"https://vercel.com/?utm_source=ts-rest\u0026utm_campaign=oss\"\n    target=\"_blank\"\n    rel=\"noreferrer\"\n  \u003e\n    \u003cimg\n      src=\"https://ts-rest.com/img/powered-by-vercel.svg\"\n      alt=\"Powered by Vercel\"\n      height=\"40\"\n    /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fts-rest%2Fts-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fts-rest%2Fts-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fts-rest%2Fts-rest/lists"}