{"id":13583783,"url":"https://github.com/sius/fakerdb","last_synced_at":"2025-07-19T13:32:33.983Z","repository":{"id":33232728,"uuid":"155290492","full_name":"sius/fakerdb","owner":"sius","description":"Generate an unlimited stream of JSON schema instances using json-schema-faker, faker, chance and insert the data into a supported database, e.g.: nedb, mongodb, postgres, mssql","archived":false,"fork":false,"pushed_at":"2024-01-10T09:17:43.000Z","size":2553,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T21:07:10.954Z","etag":null,"topics":["db","fake","faker","json","jsonschema","mocks","stream","testdata"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-29T22:36:56.000Z","updated_at":"2025-04-15T14:26:07.000Z","dependencies_parsed_at":"2024-01-24T13:07:07.178Z","dependency_job_id":null,"html_url":"https://github.com/sius/fakerdb","commit_stats":{"total_commits":101,"total_committers":2,"mean_commits":50.5,"dds":0.2277227722772277,"last_synced_commit":"5cf5bdcd687bca387e252bfc28059a5eec04be66"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sius/fakerdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sius%2Ffakerdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sius%2Ffakerdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sius%2Ffakerdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sius%2Ffakerdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sius","download_url":"https://codeload.github.com/sius/fakerdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sius%2Ffakerdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265942568,"owners_count":23853294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db","fake","faker","json","jsonschema","mocks","stream","testdata"],"created_at":"2024-08-01T15:03:47.458Z","updated_at":"2025-07-19T13:32:33.927Z","avatar_url":"https://github.com/sius.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.com/sius/fakerdb.svg?branch=master)](https://travis-ci.com/sius/fakerdb)[![codecov](https://codecov.io/gh/sius/fakerdb/branch/master/graph/badge.svg)](https://codecov.io/gh/sius/fakerdb)[![dependencies Status](https://david-dm.org/sius/fakerdb/status.svg)](https://david-dm.org/sius/fakerdb)[![devDependencies Status](https://david-dm.org/sius/fakerdb/dev-status.svg)](https://david-dm.org/sius/fakerdb?type=dev)[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/sius/fakerdb)\n\n# fakerdb\n\nGenerate an unlimited stream of JSON schema instances using [json-schema-faker](https://www.npmjs.com/package/json-schema-faker), [faker](https://www.npmjs.com/package/faker), [chance](https://www.npmjs.com/package/chance) and insert the data into a supported database, e.g.: [nedb](https://www.npmjs.com/package/nedb), [mongodb](https://www.npmjs.com/package/mongodb), [postgres](https://www.npmjs.com/package/pg), [mssql](https://www.npmjs.com/package/mssql).\n\n## Getting Started\n\n```console\nnpm install\n\n# run docker container\ndocker-compose up -d\n\nnpm test\n\n# stop docker container\ndocker-compose down\n```\n### Test Results and Performance\n\n**Test Environment**\n- Intel® Core™ i7-3520M CPU @ 2.90GHz × 4\n- 7.5 GiB\n- Linux 64 bit\n\nJSON schema\n\n```json\n// person.json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"type\": \"string\",\n      \"faker\": \"name.findName\"\n    }\n  },\n  \"required\": [\n    \"name\"\n  ]\n}\n```\n\n#### Insert 10^5 Records\n\n![insert 10.000 generated person records](./docs/fakerdb-test-10_5.png)\n\n\n#### Insert 10^6 Records\n\n![insert 100.000 generated person records](./docs/fakerdb-test-10_6.png)\n\n\n#### Insert 10^7 Records \n\n![insert 1.000.000 generated person records](./docs/fakerdb-test-10_7.png)\n\n\n## API Usage\n\nInstall\n```\nnpm i fakerdb\n```\n\n###  Stream to STDOUT\n\n```javascript\n// examples/faker-stdout.js\n\nvar { replay, jsf } = require('fakerdb')\n, faker = require('faker')\n, jsonSchemaFaker = require('json-schema-faker')\n, path = require('path');\n\njsonSchemaFaker.extend('faker', () =\u003e faker);\n\nconst SCHEMA_OBJ = {\n  type: 'object',\n  properties: {\n    name: {\n      type: 'string',\n      faker: 'name.findName'\n    }\n  },\n  required: [\n    'name'\n  ]\n};\n\nreplay(SCHEMA_OBJ, { replay: 2 })\n  .pipe(jsf(jsonSchemaFaker))\n  .pipe(process.stdout);\n\nconst SCHEMA_FILE = path.join(__dirname, './schema/person.json');\nreplay(SCHEMA_FILE, { replay: 2 })\n    .pipe(jsf(jsonSchemaFaker))\n    .pipe(process.stdout);\n\n```\n\n### Stream to file with nedb\n\n```javascript\n// examples/faker-nedb.js\n\nlet { generate }  = require('fakerdb')\n  , Datasource = require('nedb')\n  , db = new Datasource({ filename: 'faker.db', autoload: true })\n  , path = require('path');\n\nconst REPLAY = 1000;\nconst SCHEMA  = path.join(__dirname, './schema/person.json');\nconst OPTS = { replay: REPLAY, insert: { blockSize: 1000 } };\n\ngenerate(db, SCHEMA, OPTS);\n```\n\n### Stream to database\n\n- [PostgreSQL](./examples/faker-pg.js)\n- [MongoDb](./examples/faker-mongodb.js)\n\n## fakerdb CLI\n\n### Use\n\n```console\nnpm i -g fakerdb\nfakerdb --help\n```\n\n## Custom Faker Example\n\n### Create Standard Normal Distributed Samples\n\n- [JSON Schema Example](./examples/faker/person.json)\n- [Custom Faker Example](./examples/faker/custom.js)\n- [Custom Json Schema Faker](./examples/faker/custom-jsf.js)\n\n### Use\n```\ncd examples/faker\nfakerdb g -r 200000 -i person.json -f custom-jsf.js -b 1000 -o people.db \n```\n\n# References\n- [json-schema-faker](https://www.npmjs.com/package/json-schema-faker)\n- [faker](https://www.npmjs.com/package/faker)\n- [chance](https://www.npmjs.com/package/chance)\n- [probability-distributions](https://www.npmjs.com/package/probability-distributions)\n- [nedb](https://www.npmjs.com/package/nedb)\n- [mongodb](https://www.npmjs.com/package/mongodb)\n- [knex](https://www.npmjs.com/package/knex)\n- [postgres](https://www.npmjs.com/package/pg)\n- [mssql](https://www.npmjs.com/package/mssql)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsius%2Ffakerdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsius%2Ffakerdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsius%2Ffakerdb/lists"}