{"id":20269292,"url":"https://github.com/uu-z/koma","last_synced_at":"2025-08-24T04:05:56.716Z","repository":{"id":96665123,"uuid":"142522913","full_name":"uu-z/koma","owner":"uu-z","description":"An advanced framework based on easy maintenance","archived":false,"fork":false,"pushed_at":"2019-01-18T07:40:43.000Z","size":610,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T05:32:12.560Z","etag":null,"topics":["koa","koma","nodejs"],"latest_commit_sha":null,"homepage":"","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/uu-z.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}},"created_at":"2018-07-27T03:26:33.000Z","updated_at":"2019-01-18T07:40:44.000Z","dependencies_parsed_at":"2023-03-19T18:03:19.044Z","dependency_job_id":null,"html_url":"https://github.com/uu-z/koma","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/uu-z%2Fkoma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uu-z%2Fkoma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uu-z%2Fkoma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uu-z%2Fkoma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uu-z","download_url":"https://codeload.github.com/uu-z/koma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241753144,"owners_count":20014252,"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":["koa","koma","nodejs"],"created_at":"2024-11-14T12:24:21.753Z","updated_at":"2025-03-03T23:06:51.141Z","avatar_url":"https://github.com/uu-z.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koma\n\nCombind `model` `route` `controller` `services` `validators`... everything you want in just one module\n\n## install\n\n```\n\u003e yarn add koma\n```\n\n### start\n\n```js\nconst { koma } = require(\"koma\");\n\nkoma.$use({\n  routes: {\n    \"get /\": async ctx =\u003e (ctx.body = \"Hello World\")\n  },\n  start: {\n    config: {\n      PORT: 8001,\n      RUN: true\n    }\n  }\n});\n```\n\n### Graphql-compose\n\n```js\nconst _ = require(\"lodash\");\nconst { MongooseUtils } = require(\"koma/plugins/mongoose\");\nconst { models } = MongooseUtils;\nconst { signJWT } = require(\"koma/plugins/jwt\");\n\nmodule.exports = {\n  name: \"User\",\n  gql: {\n    resolvers: {\n      Mutation: {\n        Login: {\n          type: `type Login {account: Account!, jwt: String!}`,\n          args: { identifier: \"String!\", password: \"String!\" },\n          hide: true,\n          resolve: async ({ args }) =\u003e {\n            const { identifier, password } = args;\n            const account = await models(\"Account\")\n              .findOne({ $or: [{ username: identifier }] })\n              .select(\"+password\");\n            if (!account) throw new Error(\"No user founded\");\n            const validPassword = await account.verifyPassword(password);\n            if (validPassword) {\n              delete account.password;\n              return { account, jwt: signJWT({ _id: account._id, role: account.role }) };\n            } else {\n              throw new Error(\"Invalid password or username\");\n            }\n          }\n        },\n        SignUp: {\n          type: `type User {username: String!}`,\n          args: {\n            username: \"String!\",\n            password: \"String!\"\n          },\n          resolve: async ({ args }) =\u003e {\n            const user = await models(\"Account\").create(args);\n            return user;\n          }\n        }\n      }\n    }\n  },\n  models: {\n    Account: {\n      schema: {\n        username: { type: \"string\", required: true, unique: true },\n        password: { type: \"string\", select: false, required: true, bcrypt: true, hidden: true }\n      },\n      options: {\n        timestamp: true\n      }\n    }\n  }\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuu-z%2Fkoma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuu-z%2Fkoma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuu-z%2Fkoma/lists"}