由 Salim K. 出售

Mockoon lets developers design and run mock REST APIs locally or in the cloud with a desktop app, CLI, and serverless packages — no account required, fully open-source.
This block delivers the full Mockoon monorepo source under packages/, covering the shared commons library, commons-server (the mock server engine), CLI runner, serverless adapter, and cloud sync models. The primary buyers are backend and full-stack engineers who need to embed programmatic API mocking, run mock servers in Node.js processes, or integrate Mockoon's schema and migration utilities into their own tooling.
source/app/ - Electron/Angular desktop application source; not consumed programmaticallysource/cli/ - Oclif-based CLI entry point (@mockoon/cli); exposes run for process-level invocationsource/cloud/ - TypeScript models and utilities for Mockoon Cloud sync, deployments, plans, teams, and templatessource/commons/ - Core shared library: environment schema, migrations, OpenAPI converter, schema builder, route/server models, and utility functionssource/commons-server/ - Server-side runtime: mock HTTP server, Faker helpers, template parser, logger, and event listenerssource/serverless/ - Thin adapter to run a Mockoon mock server inside AWS Lambda, GCP Functions, or any serverless handlernpm install @mockoon/commons
npm install @mockoon/commons-server
npm install @mockoon/serverless
npm install @mockoon/cli
npm install @mockoon/cloud
npm install @faker-js/faker
npm install express
npm install js-yaml
npm install ajv
npm install @oclif/core
No native modules, no pod install, no Android linking required. All packages are pure Node.js/TypeScript.
Copy the source/ directory into your project root, e.g. vendor/mockoon/.
Align tsconfig.json paths so TypeScript resolves the sub-packages:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@mockoon/commons": ["vendor/mockoon/commons/src/index.ts"],
"@mockoon/commons-server": ["vendor/mockoon/commons-server/src/index.ts"],
"@mockoon/cloud": ["vendor/mockoon/cloud/src/index.ts"],
"@mockoon/serverless": ["vendor/mockoon/serverless/src"]
},
"module": "CommonJS",
"target": "ES2020",
"strict": true
}
}
If you use the built npm packages instead of source paths, install the published versions and skip the mapping.
启动隔离沙箱并在服务器端直接运行 — 无需本地配置。
此版本的 Tetrees AI Review
This Angular web app completed archive review with strong static results. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
管道 avcp-2026-08-04.1 · SHA-256 0aca4c5cb78699ab…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
审查日期 2026年8月4日
将此产品直接导入你的 AI IDE、网页构建器或云端 IDE。
将 Tetrees 连接到兼容的 AI IDE,列出你拥有的产品并获取已验证 ZIP,同时不会开放卖家上传权限。
暂无评价。
Sign in to join the discussion
Loading discussion…
pathsNo mandatory environment variables for commons or commons-server. The desktop app uses Firebase config (Config.firebaseConfig) and optional emulator flags (environment.useFirebaseEmulator), which are irrelevant outside the Electron shell.
For the serverless adapter, ensure your function runtime is Node.js 18+.
MockServer (commons-server)import { MockServer } from '@mockoon/commons-server';
class MockServer {
constructor(
environment: Environment,
options?: { enableRandomLatency?: boolean }
);
start(): void;
stop(): Promise<void>;
}
The core server class. Instantiate with a Mockoon Environment object (built via generateEnvironment or loaded from a JSON file), call start() to bind the HTTP listener, and stop() to tear it down. Use this whenever you need an in-process mock server.
generateEnvironment (commons)import { generateEnvironment } from '@mockoon/commons';
function generateEnvironment(): Environment;
Returns a fully-typed Environment object with sensible defaults (port 3000, empty routes array, UUID-assigned uuid). Use it as the starting point before pushing custom routes via addRoute or similar mutators.
migrate (commons)import { migrate } from '@mockoon/commons';
function migrate(environment: Environment): Environment;
Applies all pending schema migrations to an Environment loaded from an older Mockoon data file. Always call this before passing a user-supplied JSON file to MockServer to avoid runtime validation errors caused by stale schemas.
run (cli)import { run } from '@oclif/core';
// Re-exported by cli/src/index.ts
Invokes the Mockoon CLI programmatically. Pass process.argv or a custom argv array. Use this if you want to spin up a mock from the command line inside a Node.js script or test setup without spawning a child process.
Start a Mockoon mock server inside a Jest/Vitest test suite without any CLI or file system overhead.
import { generateEnvironment, migrate } from '@mockoon/commons';
import { MockServer } from '@mockoon/commons-server';
async function startMockServer(): Promise<MockServer> {
const env = generateEnvironment();
env.port = 3100;
env.name = 'test-mock';
// Add a simple GET /ping route
env.routes.push({
uuid: 'route-uuid-001',
type: 'http',
method: 'get',
endpoint: 'ping',
responses: [
{
uuid: 'response-uuid-001',
statusCode: 200,
label: 'OK',
headers: [{ key: 'Content-Type', value: 'application/json' }],
body: '{"status":"ok"}',
rules: [],
rulesOperator: 'OR',
disableTemplating: false,
fallbackTo404: false,
default: true,
crudKey: 'id'
}
],
enabled: true,
responseMode: null
} as any);
const migratedEnv = migrate(env);
const server = new MockServer(migratedEnv);
server.start();
return server;
}
// In your test
const server = await startMockServer();
// ... run tests against http://localhost:3100
await server.stop();
Load an environment from disk that was created with an older Mockoon version and update it before use.
import * as fs from 'fs';
import { migrate, Environment } from '@mockoon/commons';
import { MockServer } from '@mockoon/commons-server';
function loadAndMigrate(filePath: string): Environment {
const raw = fs.readFileSync(filePath, 'utf-8');
const env: Environment = JSON.parse(raw);
return migrate(env);
}
const env = loadAndMigrate('./mocks/my-api.json');
const server = new MockServer(env);
server.start();
console.log(`Mock server running on port ${env.port}`);
Type-check a sync payload received from Mockoon Cloud using the exported model interfaces.
import type { SyncModel, TeamModel, UserModel } from '@mockoon/cloud';
function handleSyncPayload(payload: unknown): void {
const sync = payload as SyncModel;
const user: UserModel = sync.user;
const team: TeamModel = sync.team;
console.log(`Syncing as ${user.email} in team ${team.name}`);
}
source/app/ - Electron shell plus Angular renderer; contains main.ts that bootstraps Firebase auth and the Angular app. Not intended for programmatic import.source/app/build-configs/ - electron-builder config files for Windows, macOS, and Linux packaging targets.source/app/build-res/ - Application icons and Windows Appx tile assets.source/app/scripts/ - One-off maintenance scripts (AUR version bump, test migration helpers, macOS notarization).source/cli/src/index.ts - Single re-export of run from @oclif/core; the CLI package entry point.source/cloud/src/index.ts - Barrel export of all cloud-side TypeScript models (sync, deploy, plans, teams, templates, user).source/commons/src/index.ts - Barrel export of the entire shared library: constants, enums, migrations, OpenAPI converter, schema builder, and all data models.source/commons-server/src/index.ts - Barrel export of the server runtime: MockServer, Faker helpers, logger, template parser, event listeners, and server utilities.source/serverless/ - Adapter package that wraps MockServer for use as a cloud function handler (AWS Lambda, GCP, Firebase).migrate(env) before passing any file-loaded environment to MockServer; older files lack required fields.env.port per test worker; Mockoon does not auto-assign free ports.@oclif/core: the CLI package targets CommonJS; if your project uses "type": "module" in package.json, import cli/src/index.ts via createRequire or set "module": "CommonJS" in the consuming tsconfig.commons-server relies on @faker-js/faker v8+; installing v7 causes runtime failures due to renamed locale APIs.source/app/src/ imports Angular and Electron globals (window.api); never import from app/ in a Node.js server context - restrict imports to commons, commons-server, cloud, and serverless.Environment.routes[].responses requires all fields including crudKey and rulesOperator; use generateEnvironment + spread rather than hand-rolling objects.I have a local copy of the Mockoon monorepo source at `vendor/mockoon/` (from the
upstream package `@mockoon/mockoon`). I also have `USAGE.md` in the project root
describing the real exports and setup.
Please help me integrate Mockoon into my Node.js/TypeScript project step by step:
1. Read `USAGE.md` for the exact import paths, real exported symbols, and tsconfig
path aliases needed.
2. Update `tsconfig.json` with the path mappings for `@mockoon/commons`,
`@mockoon/commons-server`, and any other sub-packages I need.
3. Create a `src/mock-server.ts` module that uses `generateEnvironment`, `migrate`,
and `MockServer` from the source to start a configurable in-process mock server.
4. Add a helper that loads an existing Mockoon `.json` environment file from disk,
migrates it, and starts the server.
5. Wire the mock server into my existing Express app's test setup so it starts
before tests and stops after.
6. Flag any ESM/CJS conflicts or peer dependency issues found in `USAGE.md` as
inline TODO comments.
Only use symbols documented in `USAGE.md`. Do not invent new exports.
Mockoon is released under the MIT License (see source/app/LICENSE.md and individual package LICENSE files). Upstream repository: https://github.com/mockoon/mockoon. NPM package: @mockoon/mockoon.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
完整安装指南与集成提示词将在购买后解锁。
Automation, Utilities & Developer Tools
免费