{"id":19011612,"url":"https://github.com/graphql-editor/sloth","last_synced_at":"2025-04-22T23:27:25.116Z","repository":{"id":100001667,"uuid":"138739656","full_name":"graphql-editor/sloth","owner":"graphql-editor","description":"Slothking.online CLI for file generation and live replace","archived":false,"fork":false,"pushed_at":"2018-08-30T12:53:45.000Z","size":115,"stargazers_count":10,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T16:03:19.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://slothking.online","language":"JavaScript","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/graphql-editor.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"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":"2018-06-26T13:08:35.000Z","updated_at":"2025-03-04T13:03:28.000Z","dependencies_parsed_at":"2023-05-11T14:45:11.444Z","dependency_job_id":null,"html_url":"https://github.com/graphql-editor/sloth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fsloth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fsloth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fsloth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fsloth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-editor","download_url":"https://codeload.github.com/graphql-editor/sloth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250339395,"owners_count":21414353,"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":[],"created_at":"2024-11-08T19:15:00.221Z","updated_at":"2025-04-22T23:27:25.110Z","avatar_url":"https://github.com/graphql-editor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sloth CLI \nSloth CLI is dedicated for use with [slothking.online](https://slothking.online). It generates code from slothking node graphs. Our benchmarks show that it can speed up modern web apps development process up to 2000%. It is a huge step in system desing also. \n\n## Installation\n```sh\n$ npm install -g @slothking-online/sloth\n```\n\n## Login\n```sh\n$ sloth login \u003cusername\u003e \u003cpassword\u003e\n```\nYou have to login to use all features of this CLI\n\nor if you don't have account and you haven't created one yet on [slothking.online](https://slothking.online)\n\n\n## Register\n```sh\n$ sloth login \u003cusername\u003e \u003cpassword\u003e \u003crepeat_password\u003e\n```\n\nThis will log you in automatically of course too.\n\n## Generate Code\n\nAs this is code generator, which generates code from slothking node graphs. For all examples we will use public user lib.\n\n### Node Typescript Backend based on simple http server\nGenerate backend from node graph.\n```sh\n$ sloth nodets \u003cproject\u003e \u003cpath\u003e\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eExamples (Click to expand)\u003c/summary\u003e\n\n\n  This generator generates code for your node typescript backend. You can try generating API for public user library to do so:\n\n```ts\nimport * as sloth from \"@slothking-online/node\";\nimport * as tg from \"typegoose\";\nimport { ObjectId } from \"bson\";\n\nexport type UserType = {\n  username: string;\n  password: string;\n  token: string;\n}\nexport class User extends tg.Typegoose {\n  @tg.prop() username: string;\n  @tg.prop() password: string;\n  @tg.prop() token: string;\n}\nexport const Models = () =\u003e ({\n  UserModel:new User().getModelForClass(User)\n})\n\nconst slothking: {\n  user: {\n    name: string;\n    middlewares: {\n      isUser: sloth.SlothkingMiddleware\u003c\n        {\n          token: string;\n        },\n        { \n          User: tg.InstanceType\u003cUser\u003e;\n        }\n      \u003e\n    };\n    endpoints: {\n      refresh: sloth.SlothkingEndpoint\u003c\n        {\n          token: string;\n          username: string;\n        },\n        {},\n        {\n          username: string;\n          token: string;\n        }\n      \u003e;\n      auth: sloth.SlothkingEndpoint\u003c\n        {\n          token: string;\n          username: string;\n        },\n        {},\n        {\n          username: string;\n          token: string;\n        }\n      \u003e;\n      register: sloth.SlothkingEndpoint\u003c\n        {\n          username: string;\n          password: string;\n        },\n        {},\n        {\n          username: string;\n          token: string;\n        }\n      \u003e;\n      login: sloth.SlothkingEndpoint\u003c\n        {\n          username: string;\n          password: string;\n        },\n        {},\n        {\n          username: string;\n          token: string;\n        }\n      \u003e;\n      changePassword: sloth.SlothkingEndpoint\u003c\n        {\n          password: string;\n          newPassword: string;\n        },\n        {},\n        {\n          username: string;\n          token: string;\n        }\n      \u003e;\n      resetPassword: sloth.SlothkingEndpoint\u003c\n        {\n          username: string;\n        },\n        {},\n        {}\n      \u003e;\n      resetPasswordFromLink: sloth.SlothkingEndpoint\u003c\n        {\n          newPassword: string;\n          linkToken: string;\n        },\n        {},\n        {}\n      \u003e;\n      github: sloth.SlothkingEndpoint\u003c\n        {\n          code: string;\n        },\n        {},\n        {\n          username: string;\n          token: string;\n        }\n      \u003e;\n    };\n  };\n} = {\n  user: {\n    name: 'user',\n    middlewares: {\n      isUser: {\n        name: \"isUser\"\n      }\n    },\n    endpoints: {\n      refresh: {\n        path: \"refresh\",\n        middlewares: []\n      },\n      auth: {\n        path: \"auth\",\n        middlewares: []\n      },\n      register: {\n        path: \"register\",\n        middlewares: []\n      },\n      login: {\n        path: \"login\",\n        middlewares: []\n      },\n      changePassword: {\n        path: \"changePassword\",\n        middlewares: []\n      },\n      resetPassword: {\n        path: \"resetPassword\",\n        middlewares: []\n      },\n      resetPasswordFromLink: {\n        path: \"resetPasswordFromLink\",\n        middlewares: []\n      },\n      github: {\n        path: \"github\",\n        middlewares: []\n      }\n    }\n  }\n};\nexport default slothking;\n```\n\n\u003c/details\u003e\n\n\n### Frontend fetch API\nGenerate from node graph.\n\n```sh\n$ sloth fetch-api \u003cproject\u003e \u003cpath\u003e\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eExamples (Click to expand)\u003c/summary\u003e\n\n  This generator generates ready to use functions for your backend solution. You can try generating API for public user library to do so:\n\n\n```sh\n$ sloth fetch-api user user.ts\n```\n\n```ts\nexport type UserType = {\n  username: string;\n  password: string;\n  token: string;\n};\nconst slothking: {\n  user: {\n    name: string;\n    endpoints: {\n      refresh: (\n        params: {\n          host: string;\n          props: {\n            token: string;\n            username: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{\n        username: string;\n        token: string;\n      }\u003e;\n      auth: (\n        params: {\n          host: string;\n          props: {\n            token: string;\n            username: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{\n        username: string;\n        token: string;\n      }\u003e;\n      register: (\n        params: {\n          host: string;\n          props: {\n            username: string;\n            password: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{\n        username: string;\n        token: string;\n      }\u003e;\n      login: (\n        params: {\n          host: string;\n          props: {\n            username: string;\n            password: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{\n        username: string;\n        token: string;\n      }\u003e;\n      changePassword: (\n        params: {\n          host: string;\n          props: {\n            password: string;\n            newPassword: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{\n        username: string;\n        token: string;\n      }\u003e;\n      resetPassword: (\n        params: {\n          host: string;\n          props: {\n            username: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{}\u003e;\n      resetPasswordFromLink: (\n        params: {\n          host: string;\n          props: {\n            newPassword: string;\n            linkToken: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{}\u003e;\n      github: (\n        params: {\n          host: string;\n          props: {\n            code: string;\n          };\n          method: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" | \"PUT\";\n        }\n      ) =\u003e Promise\u003c{\n        username: string;\n        token: string;\n      }\u003e;\n    };\n  };\n} = {\n  user: {\n    name: \"user\",\n    endpoints: {\n      refresh: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/refresh`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      auth: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/auth`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      register: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/register`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      login: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/login`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      changePassword: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/changePassword`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      resetPassword: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/resetPassword`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      resetPasswordFromLink: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/resetPasswordFromLink`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json()),\n      github: ({ host, props, method = \"POST\" }) =\u003e\n        fetch(`${host}user/github`, {\n          body: JSON.stringify(props),\n          method\n        }).then(res =\u003e res.json())\n    }\n  }\n};\nexport default slothking;\n```\n\n\u003c/details\u003e\n\n\n\n### CoronaSDK lua api\n\n```sh\n$ sloth corona-sdk \u003cproject\u003e \u003cpath\u003e\n```\n\n### More generators\n\nMore generators will be added soon\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-editor%2Fsloth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-editor%2Fsloth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-editor%2Fsloth/lists"}