{"id":21030168,"url":"https://github.com/varharrie/mokia","last_synced_at":"2026-03-06T21:33:24.780Z","repository":{"id":33713823,"uuid":"160700096","full_name":"varHarrie/mokia","owner":"varHarrie","description":"🐒 An out of the box mock API server to help quickly create back-end prototype and data simulations.","archived":false,"fork":false,"pushed_at":"2022-12-10T16:36:51.000Z","size":3401,"stargazers_count":113,"open_issues_count":12,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T08:02:00.950Z","etag":null,"topics":["api","cli","generator","library","mock","nodejs","server","utility"],"latest_commit_sha":null,"homepage":"https://varharrie.github.io/mokia/","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/varHarrie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-06T16:14:11.000Z","updated_at":"2024-02-23T19:06:10.000Z","dependencies_parsed_at":"2023-01-15T02:15:25.423Z","dependency_job_id":null,"html_url":"https://github.com/varHarrie/mokia","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fmokia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fmokia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fmokia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fmokia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varHarrie","download_url":"https://codeload.github.com/varHarrie/mokia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254330822,"owners_count":22053056,"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","cli","generator","library","mock","nodejs","server","utility"],"created_at":"2024-11-19T12:16:36.207Z","updated_at":"2026-03-06T21:33:24.702Z","avatar_url":"https://github.com/varHarrie.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://varharrie.github.io/mokia/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n    \u003cimg width=\"180\" src=\"https://raw.githubusercontent.com/varharrie/mokia/master/packages/docs/docs/.vuepress/public/logo.png\" alt=\"logo\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/varharrie/mokia/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/mokia.svg\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/mokia\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/mokia.svg\" alt=\"Version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmcharts.com/compare/mokia?minimal=true\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/mokia.svg\" alt=\"Downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/varHarrie/mokia/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/varharrie/mokia.svg\" alt=\"Issues\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# Mokia\n\n🐒 An out of the box mock API server to help quickly create back-end prototype and data simulations.\n\nDocumentation: [中文](https://varharrie.github.io/mokia/)\n\n## Basic Usage\n\nCreate entry file (e.g. index.js):\n\n```javascript\n// index.js\nmodule.exports = {\n  port: 3000,\n  'GET /users'() {\n    return this.list(() =\u003e ({ id: this.uuid(), name: this.fullName() }));\n  },\n  'GET /users/:id'(req) {\n    return { id: req.params.id, name: this.fullName() };\n  },\n};\n```\n\nStart local http server:\n\n```bash\nnpx mokia index.js --watch\n```\n\nOpen browser and go to http://localhost:3000/users, you will get the response.\n\n## Advanced Usage\n\nTypeScript Support and Class-style mock schema:\n\n```typescript\n// index.ts\n\nimport mokia from 'mokia';\n\nclass User {\n  @mokia.uuid()\n  id: string;\n\n  @mokia.fullName()\n  name: string;\n\n  constructor(id?: string) {\n    if (id) this.id = id;\n  }\n}\n\nclass Article {\n  @mokia.uuid()\n  id: string;\n\n  @mokia.generate(User)\n  author: User;\n\n  @mokia.passage()\n  content: string;\n\n  constructor(id?: string) {\n    if (id) this.id = id;\n  }\n}\n\nexport default mokia.defineConfig({\n  port: 3000,\n  'GET /users': mokia.list(User),\n  'GET /users/:id': (req) =\u003e new User(req.params.id),\n  'GET /articles': mokia.list(Article),\n  'GET /articles/:id': (req) =\u003e new Article(req.params.id),\n});\n```\n\n### License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarharrie%2Fmokia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarharrie%2Fmokia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarharrie%2Fmokia/lists"}