Plugin
plugins: [pluginFaker()]Officialv5.1.4kubb >=5.8.0node >=22
Faker
@kubb/plugin-faker
Generates a Faker.js mock-data factory for every schema in your OpenAPI spec.
kubb add plugin-faker
fakermock-datamocksfixturestestingcodegenopenapi
- Downloads309.2K/ monthnpm, last 30 days
- GitHub stars8kubb-labs/plugins
- Unpacked size386.2kBv5.1.4 on npm
- Latest release1h agov5.1.4 · Oct 13, 2026
Generates a Faker.js mock-data factory for every schema in your OpenAPI spec. Use the factories in tests, Storybook, and local development without a running backend. Each factory accepts partial data that overrides the generated values.
@kubb/plugin-msw can use these factories to fill mock responses.
Installation
bun add -d @kubb/plugin-fakerpnpm add -D @kubb/plugin-fakernpm install --save-dev @kubb/plugin-fakeryarn add -D @kubb/plugin-fakerOr run kubb add plugin-faker to install the version the Kubb registry pins and add pluginFaker() to kubb.config.ts.
Setup
- Add
@kubb/plugin-tsfor the factory return types. - Install
@faker-js/fakerv9 or higher in the app that uses the generated code.
Options worth knowing
seedpasses a fixed seed tofaker.seed(...), so every run returns the same data.localesets the Faker locale. The default isen.dateParserformats date and time strings withfaker(default),dayjs, ormoment. Install the library you pick.regexGeneratorturns apatterninto a string withfaker(default) orrandexp.typeModesets the factory types:inferred(default) derives them from the generated values,schemauses the declared model type.
Dependencies
No extension dependencies.