{"id":14155509,"url":"https://github.com/opvious/abaca","last_synced_at":"2025-08-01T19:04:35.871Z","repository":{"id":69473771,"uuid":"604304668","full_name":"opvious/abaca","owner":"opvious","description":"OpenAPI TypeScript SDK generator with strong type guarantees and minimal boilerplate","archived":false,"fork":false,"pushed_at":"2025-04-09T13:18:43.000Z","size":1007,"stargazers_count":6,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-22T15:43:07.797Z","etag":null,"topics":["fetch","javascript","koa","openapi","sdk","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opvious.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-02-20T19:20:02.000Z","updated_at":"2025-03-29T22:25:49.000Z","dependencies_parsed_at":"2024-09-12T10:56:01.230Z","dependency_job_id":"9c0d4f46-1dfa-4d10-8169-c2eca9a9b101","html_url":"https://github.com/opvious/abaca","commit_stats":{"total_commits":130,"total_committers":2,"mean_commits":65.0,"dds":0.2846153846153846,"last_synced_commit":"6a21b2275db29b57dfc93d011a48d066cb73c06c"},"previous_names":["opvious/abaca","mtth/yasdk"],"tags_count":94,"template":false,"template_full_name":null,"purl":"pkg:github/opvious/abaca","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opvious%2Fabaca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opvious%2Fabaca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opvious%2Fabaca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opvious%2Fabaca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opvious","download_url":"https://codeload.github.com/opvious/abaca/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opvious%2Fabaca/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267916052,"owners_count":24165059,"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-07-30T02:00:09.044Z","response_time":70,"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":["fetch","javascript","koa","openapi","sdk","typescript"],"created_at":"2024-08-17T08:03:44.719Z","updated_at":"2025-08-01T19:04:35.836Z","avatar_url":"https://github.com/opvious.png","language":"TypeScript","funding_links":[],"categories":["typescript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/logo.png\" height=\"200\" stype=\"margin: 2em;\"/\u003e\n\u003c/p\u003e\n\n# Abaca [![CI](https://github.com/opvious/abaca/actions/workflows/ci.yml/badge.svg)](https://github.com/opvious/abaca/actions/workflows/ci.yml) [![NPM version](https://img.shields.io/npm/v/abaca-cli.svg)](https://www.npmjs.com/package/abaca-cli) [![codecov](https://codecov.io/gh/opvious/abaca/branch/main/graph/badge.svg?token=XuV2bcZPjJ)](https://codecov.io/gh/opvious/abaca)\n\nAn [OpenAPI][] SDK generator for TypeScript with __strong type guarantees__ and\n__minimal boilerplate__.\n\n+ Exports __dependency-free, single-file client SDKs__ with a tiny runtime\n  footprint\n+ Handles [form and file uploads](/examples/forms-and-files), [smart\n  streaming](/examples/smart-streaming), [content-type\n  switching](/examples/content-types), and more\n+ Supports both native and custom `fetch` implementations\n+ Provides [Koa][] integrations for server routing and proxying\n\n\n## Motivation\n\nAt [Opvious][], we use OpenAPI to describe both our public and internal APIs. To\nprovide a great experience for our users, we support granular response codes and\na variety of content-types. For example we provide [smart\nstreaming](examples/smart-streaming) when solving optimization models,\nsending results back to clients as early as possible.\n\nWe tried various TypeScript SDK generator libraries (see the\n[alternatives](#alternatives) section below) but didn't find one which could\nexpress these capabilities without compromising type-safety. Abaca is our\nattempt at building a library to address these use-cases.\n\nWhile we originally built Abaca for internal use, we believe it would be useful\nto others and are happy to make it available to the open-source community. We\nhope in particular to help those developing APIs which push the boundaries of\nunary JSON calls.\n\n\n## Preview\n\nFirst, generate the SDK from an OpenAPI specification (URL or local path). For\nexample from [Stripe's specification](https://github.com/stripe/openapi):\n\n```sh\nnpx abaca-cli generate \\\n  https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml \\\n  --output src/sdk.gen.ts \\\n  --include '*Account*=y' # Optional operation filter\n```\n\nThen simply import the generated file in your code and instantiate the SDK. The\nreturned instance contains a strongly typed method for each operation defined in\nthe original OpenAPI specification.\n\n```typescript\nimport {createSdk} from './sdk.gen.js'; // File generated above\n\nconst sdk = createSdk({ // SDK-wide options (common headers, ...)\n  headers: {authorization: `Bearer sk_test_your_key`},\n});\n```\n\nYou're now ready to make type-safe API calls. The compiler will ensure that each\nmethod's inputs (request body, parameters, content type header...) match their\ntype in the specification. The response (body and code) is also extensively\ntype-checked taking into account the request's `accept` header.\n\n```typescript\nconst res = await sdk.GetAccount();\nswitch (res.code) { // Typed response code\n  case 200:\n    console.log(res.body.capabilities); // Narrowed response body type\n    break;\n  // ...\n}\n```\n\nTake a look at the following examples to see how Abaca safely and concisely\nhandles various use-cases:\n\n+ [JSON API](/examples/json)\n+ [Form and file uploads](/examples/forms-and-files)\n+ [Smart streaming](/examples/smart-streaming)\n+ [Content-type switching](/examples/content-types)\n\n\n## Packages\n\n+ [`abaca-cli`](/packages/abaca-cli), client SDK generator CLI\n+ [`abaca`](/packages/abaca), shared utilities\n+ [`abaca-koa`](/packages/abaca-koa), Koa integrations for server routing and\n  proxying\n\n\n## Developing\n\nAbaca uses [pnpm](https://pnpm.io/):\n\n```sh\npnpm i\npnpm dlx husky install # Optional, to set up git hooks (only needed once)\npnpm t\n```\n\n\n## Contributing\n\nContributions are most welcome. If you have an idea that would make Abaca\nbetter, please create an issue or submit a pull request!\n\n\n## Alternatives\n\nSee below for a short list of related libraries. Abaca is inspired by our\nfavorite parts from each of them.\n\n+ [`openapi-fetch`](https://github.com/drwpow/openapi-typescript), lightweight\n  with excellent schema types via `openapi-typescript`\n+ [`oazapfts`](https://github.com/oazapfts/oazapfts), granular response codes in\n  explicit mode\n+ [`openapi-typescript-codegen`](https://github.com/ferdikoomen/openapi-typescript-codegen),\n  supports external references\n+ [`openapi-typescript-fetch`](https://github.com/ajaishankar/openapi-typescript-fetch),\n  includes utility types (requests, responses, etc.)\n\nMore tools are also listed here: https://tools.openapis.org/categories/sdk.html\n\n\n[Koa]: https://koajs.com\n[OpenAPI]: https://www.openapis.org\n[Opvious]: https://www.opvious.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopvious%2Fabaca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopvious%2Fabaca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopvious%2Fabaca/lists"}