{"id":15008657,"url":"https://github.com/sdkgen/sdkgen","last_synced_at":"2025-04-05T19:15:23.150Z","repository":{"id":37016675,"uuid":"238742431","full_name":"sdkgen/sdkgen","owner":"sdkgen","description":"sdkgen is a tool to help design, implement and maintain good APIs with minimal effort","archived":false,"fork":false,"pushed_at":"2023-12-19T13:28:09.000Z","size":3203,"stargazers_count":68,"open_issues_count":35,"forks_count":37,"subscribers_count":8,"default_branch":"main","last_synced_at":"2023-12-19T16:11:33.521Z","etag":null,"topics":["api","csharp","dart","hacktoberfest","kotlin","restful","rpc","sdkgen","typescript"],"latest_commit_sha":null,"homepage":"https://sdkgen.github.io/","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/sdkgen.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}},"created_at":"2020-02-06T17:14:06.000Z","updated_at":"2023-12-21T19:33:17.454Z","dependencies_parsed_at":"2023-12-21T19:43:36.042Z","dependency_job_id":null,"html_url":"https://github.com/sdkgen/sdkgen","commit_stats":{"total_commits":1154,"total_committers":44,"mean_commits":"26.227272727272727","dds":"0.35528596187175043","last_synced_commit":"8649bb0481c336330878cdabf22785bdd6ae0e84"},"previous_names":[],"tags_count":37,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdkgen%2Fsdkgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdkgen%2Fsdkgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdkgen%2Fsdkgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdkgen%2Fsdkgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdkgen","download_url":"https://codeload.github.com/sdkgen/sdkgen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386266,"owners_count":20930619,"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","csharp","dart","hacktoberfest","kotlin","restful","rpc","sdkgen","typescript"],"created_at":"2024-09-24T19:19:53.864Z","updated_at":"2025-04-05T19:15:23.122Z","avatar_url":"https://github.com/sdkgen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sdkgen\n\n[![test status badge](https://github.com/sdkgen/sdkgen/workflows/test/badge.svg?branch=main)](https://github.com/sdkgen/sdkgen/actions)\n[![telegram badge](https://img.shields.io/badge/telegram-sdkgen-179CDE)](https://t.me/sdkgen)\n\n# Getting Started\n\n## Installing sdkgen\n\nFirst of all you need Node.js 16 or newer on your machine. We recommend using the latest LTS version, check for it here: https://nodejs.org/en/download/.\n\nInstall the global CLI:\n\n```\nnpm i -g @sdkgen/cli\n```\n\n## Creating an API description\n\nCreate an `api.sdkgen` to describe your API. For example:\n\n```\ntype Post {\n  id: uuid\n  title: string\n  body: string\n  createdAt: datetime\n  author: {\n    name: string\n  }\n}\n\nfn getPost(id: uuid): Post?\n```\n\nYou can then generate the TypeScript source for this description with `sdkgen api.sdkgen -o api.ts -t typescript_nodeserver`.\n\n## Creating base project\n\nLet's start a new project with TypeScript:\n\n```\nnpm init -y\nnpm i --save-dev typescript\nnpm i @sdkgen/node-runtime\nnpx tsc --init -t esnext\n```\n\nThen create a `main.ts` file:\n\n```typescript\n// Import sdkgen's runtime and the generated file\nimport { SdkgenHttpServer } from \"@sdkgen/node-runtime\";\nimport { api } from \"./api\";\n\n// Every endpoint described must receive some implementation\napi.fn.getPost = async (ctx, { id }) =\u003e {\n  return {\n    id,\n    title: \"Getting Started\",\n    author: {\n      name: \"John Doe\"\n    },\n    body: \"Lorem ipsum\",\n    createdAt: new Date(),\n  };\n};\n\n// Start a HTTP server for the API\nconst server = new SdkgenHttpServer(api);\nserver.listen(8000);\n```\n\n## Run the project\n\nBuild and run it:\n\n```\nnpx tsc\nnode main.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdkgen%2Fsdkgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdkgen%2Fsdkgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdkgen%2Fsdkgen/lists"}