Skip to content

sonofmagic/mokup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

440 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mokup logo

mokup

File-based mock toolkit for Vite, CLI builds, and runtime usage.

Website · Playground · GitHub

Why mokup

  • File-based routing via filename suffixes like users.get.json.
  • JSON/JSONC and TS/JS handlers powered by Hono Context.
  • Works in Vite dev, CLI builds (workers), and runtime adapters.
  • Built-in headers, status, delays, and middleware hooks.

Requirements

  • Node.js ^20.19.0 || >=22.12.0

Upgrade Notes

  • Published packages are ESM-only. CommonJS require() is no longer supported.
  • Internal build packages now use tsdown on top of Rolldown.
  • Shared build helpers are exposed from @mokup/shared/rolldown.

Quick start

Create mock/users.get.json:

{ "ok": true }

Create mock/login.post.ts:

export default async (c) => {
  const body = await c.req.json().catch(() => ({}))
  return { ok: true, user: body }
}

Tip: you can use defineHandler for better IntelliSense:

import { defineHandler } from 'mokup'

export default defineHandler(async (c) => {
  const body = await c.req.json().catch(() => ({}))
  return { ok: true, user: body }
})

Follow the docs at https://mokup.icebreaker.top/ for Vite and CLI setup. Upgrade details: docs/guide/migration-v1.md

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md.

Development Checks

  • pnpm run validate:fast
  • pnpm run guard:migration
  • pnpm run typecheck:fast
  • pnpm run lint:lines:guard
  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm test:e2e:serial

Contributors

Thanks to all contributors!

Authors

ice breaker hi@sonofmagic.top

License

Distributed under the MIT License. See LICENSE for more information.

About

Fast, composable mock tooling

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Sponsor this project

Packages

 
 
 

Contributors