
Security News
upm Launches as a Fast, Tiny Package Manager Written in TypeScript
upm uses Node.js to deliver fast npm installs in about 250 KB, with a JavaScript API and security defaults.
A modern TypeScript CLI tool for mocking backend APIs using YAML files. Built with Bun by design for TypeScript-native performance and seamless .ts file execution without compilation. Perfect for frontend developers who need to simulate backend APIs during development.
/users/:id)@mock directivesnpm install -g fake-end
Or use it directly with npx:
npx fake-end run
Note: While distributed via npm for compatibility, Fake-End is built with Bun and leverages its TypeScript-native capabilities for optimal performance. The tool can execute
.tsfiles directly without compilation, making it perfect for TypeScript-first development workflows.
mock_server directory in your project rootmkdir mock_server
echo "- method: GET
path: /hello
status: 200
body:
message: 'Hello, World!'" > mock_server/hello.yaml
npx fake-end run
Your mock server will be running at http://localhost:4000!
Each YAML file contains an array of endpoint definitions:
- method: GET # HTTP method (GET, POST, PUT, DELETE, PATCH)
path: /users/:id # Route path (supports parameters)
status: 200 # HTTP status code
body: # Response body (can be any valid JSON)
id: ":id"
name: "Mock User"
email: "user@example.com"
delayMs: 150 # Optional delay in milliseconds
Files in nested folders become part of the URL path:
mock_server/
├── users.yaml # Routes: /users/*
├── auth.yaml # Routes: /auth/*
└── api/
└── v1/
└── products.yaml # Routes: /api/v1/products/*
Use :parameter syntax in your paths:
- method: GET
path: /users/:id
status: 200
body:
id: ":id" # Will be replaced with actual parameter
name: "User :id" # Dynamic interpolation
Access request data in your responses:
- method: POST
path: /users
status: 201
body:
name: "{{body.name}}" # From request body
email: "{{body.email}}" # From request body
id: "{{query.generateId}}" # From query parameters
fake-end run [options]
Options:
-p, --port <port> Port to run the server on (default: 4000)
-d, --dir <directory> Directory containing mock YAML files (default: mock_server)
-v, --verbose Enable verbose logging
--no-cache Disable TypeScript interface caching for development
--dynamic-mocks Execute mock functions on each request instead of at startup
-h, --help Display help for command
Generate TypeScript interface or YAML mock files from cURL commands:
fake-end generate [options]
Options:
-c, --curl <curl> cURL command to analyze and mock
-f, --file <file> File containing cURL command
-o, --output <output> Output directory for generated files (default: mock_server)
--yaml Generate YAML files instead of TypeScript interfaces
--execute Force execution of the cURL command to capture actual response
--no-execute Skip execution and infer response structure instead
--ollama Use Ollama for AI-powered response generation
--ollama-model <model> Ollama model to use (default: qwen2.5-coder:0.5b)
--ollama-host <host> Ollama host URL (default: http://localhost:11434)
-h, --help Display help for command
mock_server/users.yaml:
- method: GET
path: /users
status: 200
body:
- id: "1"
name: "John Doe"
email: "john@example.com"
- id: "2"
name: "Jane Smith"
email: "jane@example.com"
- method: GET
path: /users/:id
status: 200
body:
id: ":id"
name: "User :id"
email: "user:id@example.com"
delayMs: 100
- method: POST
path: /users
status: 201
body:
id: "new-user-id"
name: "{{body.name}}"
email: "{{body.email}}"
message: "User created successfully"
mock_server/auth.yaml:
- method: POST
path: /auth/login
status: 200
body:
token: "mock-jwt-token"
user:
id: "1"
email: "{{body.email}}"
name: "Mock User"
delayMs: 200
- method: POST
path: /auth/register
status: 201
body:
message: "User registered successfully"
user:
id: "new-user-id"
email: "{{body.email}}"
name: "{{body.name}}"
mock_server/api/v1/products.yaml:
- method: GET
path: /products
status: 200
body:
data:
- id: "1"
name: "Product 1"
price: 99.99
pagination:
page: 1
total: 1
- method: GET
path: /products/:id
status: 200
body:
id: ":id"
name: "Product :id"
price: 49.99
This creates endpoints at:
GET /api/v1/productsGET /api/v1/products/:idGenerate accurate TypeScript interfaces with strict typing from cURL commands:
# Generate TypeScript interface with strict typing (default)
fake-end generate --curl "https://pokeapi.co/api/v2/pokemon/ditto"
# Generate YAML files instead
fake-end generate --curl "https://api.example.com/users/123" --yaml
# Force execution to capture real response structure
fake-end generate --curl "https://api.example.com/users" --execute
# Generate from cURL command with headers and data
fake-end generate --curl "curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{\"name\":\"John\",\"email\":\"john@example.com\"}'"
# Use AI to generate realistic responses (requires Ollama)
fake-end generate --curl "curl -X GET https://api.example.com/products" --ollama
Generated TypeScript Interface Example:
// Generated from Pokemon API
interface ApiV2PokemonDittoResponse {
abilities: { ability: { name: string; url: string }; is_hidden: boolean; slot: number }[];
base_experience: number;
sprites: {
front_default: string;
back_default: string;
other: {
"dream_world": { front_default: string };
"official-artwork": { front_default: string }
};
versions: {
"generation-i": {
"red-blue": { front_default: string; back_default: string }
}
}
};
// ... all properties with accurate, nested typing
}
Fake-End can automatically generate realistic mock data from TypeScript interface definitions:
// types/User.ts
interface User {
id: string;
name: string;
email: string;
age: number;
isActive: boolean;
createdAt: Date;
}
# mock_server/users.yaml
- method: GET
path: /users/:id
status: 200
interfacePath: "./types/User.ts#User" # Points to TypeScript interface
body: {} # Will be auto-generated from interface
The server will automatically generate realistic data matching your TypeScript interface:
{
"id": "a7b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"name": "Sarah Johnson",
"email": "sarah.johnson@example.com",
"age": 28,
"isActive": true,
"createdAt": "2024-03-15T10:30:00.000Z"
}
Use @mock directives in TypeScript interfaces for custom static and dynamic values:
interface Product {
/** @mock 12345 */
id: number;
/** @mock "Custom Product Name" */
name: string;
/** @mock true */
inStock: boolean;
/** @mock {"nested": "object", "value": 42} */
metadata: object;
}
interface DynamicProduct {
/** @mock () => Date.now() */
timestamp: number;
/** @mock () => `user_${crypto.randomUUID()}` */
userId: string;
/** @mock () => Math.random() > 0.5 */
isOnSale: boolean;
/** @mock () => ['red', 'blue', 'green'][Math.floor(Math.random() * 3)] */
color: string;
/** @mock () => ({ lat: Math.random() * 180 - 90, lng: Math.random() * 360 - 180 }) */
coordinates: { lat: number; lng: number };
}
Fake-End automatically detects common property names and uses appropriate Faker.js functions:
interface User {
id: number; // Auto-generates: faker.number.int()
email: string; // Auto-generates: faker.internet.email()
firstName: string; // Auto-generates: faker.person.firstName()
lastName: string; // Auto-generates: faker.person.lastName()
phone: string; // Auto-generates: faker.phone.number()
website: string; // Auto-generates: faker.internet.url()
avatar: string; // Auto-generates: faker.image.avatar()
// ... and many more
}
interface ProductWithFaker {
/** @mock faker.number.int({ min: 1000, max: 9999 }) */
id: number;
/** @mock faker.commerce.productName() */
name: string;
/** @mock faker.number.float({ min: 10, max: 500, fractionDigits: 2 }) */
price: number;
/** @mock faker.helpers.arrayElement(["electronics", "clothing", "books"]) */
category: string;
/** @mock faker.lorem.paragraph() */
description: string;
/** @mock faker.date.past().toISOString() */
createdAt: string;
}
- method: GET
path: /users
status: 200
body:
users: "{{faker.helpers.multiple(faker.helpers.arrayElement([{id: faker.string.uuid(), name: faker.person.fullName(), email: faker.internet.email()}]), {count: 10})}}"
pagination:
total: 100
page: 1
limit: 10
Use Ollama for intelligent response generation based on cURL commands:
# Install and start Ollama first
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull qwen2.5-coder:0.5b
# Generate intelligent mocks
fake-end generate --curl "curl -X GET https://api.example.com/analytics/dashboard" --ollama
The AI will analyze the endpoint and generate contextually appropriate mock responses.
Use guard functions to add conditional logic and validation to your endpoints:
- method: POST
path: /products
status: 200
guard:
condition:
field: "price"
operator: "greater_than"
value: 0
left: # When condition fails
status: 400
body:
error: "Price must be greater than 0"
code: "INVALID_PRICE"
right: # When condition passes
status: 201
body:
message: "Product created successfully"
id: "{{body.id}}"
name: "{{body.name}}"
price: "{{body.price}}"
/**
* @guard {
* "condition": { "field": "email", "operator": "contains", "value": "@" },
* "left": { "status": 400, "body": { "error": "Invalid email format" } },
* "right": { "status": 201, "body": { "message": "User created", "id": "new-user-123" } }
* }
*/
interface CreateUserResponse {
message: string;
id: string;
email?: string;
}
equals / not_equalsgreater_than / less_thangreater_than_or_equal / less_than_or_equalcontains / not_containsstarts_with / ends_withmatches_regexis_null / is_not_nullis_empty / is_not_emptyThe Either pattern is built into the type system for error handling:
import { Either, left, right, isLeft, isRight } from 'fake-end';
// Type-safe error handling
type APIResult<T> = Either<{ error: string }, T>;
interface UserResponse {
result: APIResult<{ id: string; name: string }>;
}
// Usage example
const handleResponse = (response: APIResult<User>) => {
if (isLeft(response)) {
console.log('Error:', response.value.error);
} else {
console.log('Success:', response.value.name);
}
};
Use generated TypeScript interfaces as API contracts for frontend/backend alignment:
# Generate TypeScript contracts from production API
fake-end generate --curl "https://api.production.com/users/123" --execute
fake-end generate --curl "https://api.production.com/products" --execute
# This creates strict TypeScript interfaces that match your actual API
// Generated interface can be shared between frontend and backend teams
export interface ApiV1UsersResponse {
id: string;
email: string;
profile: {
firstName: string;
lastName: string;
avatar: string;
};
permissions: string[];
createdAt: string;
updatedAt: string;
}
// Frontend can import and use these types
import { ApiV1UsersResponse } from './contracts/users';
# Start mock server with contract-based interfaces
fake-end run --dir ./contracts
# Frontend developers get realistic mock data that matches production
Control when mock functions execute using the --dynamic-mocks flag:
# Static execution (default) - functions run once at startup
fake-end run
# Dynamic execution - functions run on each request
fake-end run --dynamic-mocks
Static Mode (default):
Dynamic Mode:
Fake-End is built with Bun by design to leverage TypeScript-native performance and seamless .ts file execution. This architectural choice enables the tool to run TypeScript interfaces and mock functions directly without compilation overhead.
.ts files directly without build steps# Install dependencies
bun install
# Development mode (runs TypeScript directly)
bun run dev
# Start development server
bun run dev run
# Build the project for distribution
bun run build
# Run tests (executes .ts test files natively)
bun test
bun test:unit # Unit tests only
bun test:e2e # End-to-end tests only
# Code quality
bun run lint # Run ESLint
bun run lint:fix # Auto-fix linting issues
bun run tsc # TypeScript compilation check
bun run verify # Full verification pipeline
# Run the built version
bun start
The choice of Bun enables Fake-End to provide a TypeScript-first experience where:
@mock directives run natively.ts filesContributions are welcome! Please feel free to submit a Pull Request.
MIT
FAQs
A modern TypeScript CLI tool for mocking backend APIs using YAML files
The npm package fake-end receives a total of 0 weekly downloads. As such, fake-end popularity was classified as not popular.
We found that fake-end demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
upm uses Node.js to deliver fast npm installs in about 250 KB, with a JavaScript API and security defaults.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.