π The futuristic API Mock Server for Frontend
β¨ UPDATE:
While Manta Style is designed to be a mock server that converts type definitions into mock data. The core of Manta Style compiles definitions and makes them usable at JavaScript runtime. The runtime also supports input formatting and validation other than mocking data.
For more tools built with Manta Style core runtime, please check out Tools.
Check out the Quick Start page for a quick overview.
Manta Style generates "real" (enough) mock data from your type definitions.
With Manta Style, you can start implementing feature once your data schema is defined. But Manta Style is more than just that.
Manta Style officially supports TypeScript and Flow at the moment.
interface User {
/**
* @faker {{internet.userName}}
*/
userName: string; // Amina.Langosh49
/**
* @faker date.past
*/
birthday: number; // 1529370938452
/**
* @example Croatia
*/
country: string; // Croatia
}
type WithResponseSuccess<T> = {
status: 'ok';
data: T;
};
type WithResponseFailure = {
status: 'error';
/**
* @example Bad Request
*/
message: string;
};
type WithResponse<T> = WithResponseSuccess<T> | WithResponseFailure;
Manta Style will generate either the error case or the normal case according to your declarations. Already have your list of error conditions and messages well-defined with your back end? You are in the luck! Manta Style will generate those cases for you just like in real world.
This also gives us one more motivation to fine-tune the typing to our codebase.
Implementing boundary cases has been hair pulling. With Manta Style you can supply a snapshot and have it returned every time until you finish.
Need more feature? Create an issue and let us know how Manta Style can help you.
npm install
npm run bootstrap
npm run build
- Magic Type, a CLI tool that compiles TypeScript definitions to type objects runnable at JavaScript runtime.
- Zhongliang Wang for original idea, architecture design, initial implementation of runtime and transformers.
- Tan Li Hau for the design and implementation of selective mocking, plugin system, FlowType support and many official plugins.
- Jennie Ji for implementation of live-reload feature.
- Wei Gao for brilliant documentation.
Manta Style is MIT licensed