Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Faker.js – generate fake data in the browser and Node (github.com/marak)
138 points by tilt on Dec 29, 2015 | hide | past | favorite | 28 comments


This reminds me of an old project of mine[0], this generates Arabic names.

[0] https://github.com/RaedsLab/Tunisian_Name_Generator


Curious why you made this. Just checked it out. Why the phone number?


I've been using this in conjunction with chance.js making it very easy to generate complex data sets

http://chancejs.com/


This looks interesting and very useful. However my only question is what is the license of those generated avatar?


The avatars come from UI Faces: http://uifaces.com/

You have to give your consent in order to appear there.


I used this at one point when I needed a large synthetic "customer" dataset, and found the sample size to be somewhat limited. I had to munge first/last names with added random characters. But looking at it now, it appears that's improved. For example, there are about 3000x500 first/last name combinations, for a total of about 1.5M possible full names (for en_US). However, if you need, say, as many unique last names as possible, 500 might still be too few. Still, a nice project.


Faker.js now supports something like 30+ locales.

This should expand the amount of name combinations considerably.



I always liked this library. Wrote a tutorial around the concept of it on websesign tuts a few years back, though I'm not sure how dated it is in relation to the API now (http://webdesign.tutsplus.com/tutorials/filler-content-tools...). Anyway, it deals with one way the library could be used in the browser, in combination with other filler content services, to aid "designing" in the browser.


Why would I want to use this? Is this for test data or for obfuscation?


Could be used for both. I've used it for generating test data in unit/integration tests and also for obfuscation where production-dumps are needed.

It's useful for having in development as well, when you need to have X number of forms and X number of users but you don't want to have to manually create that every time you re-create the environment.


people use it for building dating sites.


I used this to generate test data for application benchmarking. That is, when I wanted real-ish data to test scalability.


I'm currently using it to mock my API responses for a front-end application.


Writing mock APIs for front-end dev.


So our front-end devs can try their interface designs with different data.


we use it for writing fixtures for tests


It can help a lot when writing UI/Selenium tests with mocked/fake backend (as long as the application data model is well defined). i also wrote a similar library around es6 generators that defines application data structures as plain JS objects and generates data objects out of it using fake random data https://github.com/dmitriiabramov/sharkhorse


Faker.js is pretty great. I wrote a simple package to generate fake data for MySQL tables. It's rather basic, but it's been useful to me. It probably wouldn't be hard to stick a DB abstraction layer in front to use with other backends.

https://github.com/michaelmior/mysql-faker


Similarly I wrote a tool that uses Faker to generate api fixtures :) Why go stright to the DB when you can test your api at the same time?

https://github.com/MusicMapIo/Mokr


Good idea. Can anyone comment on this vs traditional QuickCheck like tools? We use property-based testing as our default. It seems like Faker is a less composable version.


+1 for using hook.io for the hosted API. I just love this service and think this is a great use case for it. Will support it on kickstarter.


Hook.io is still a thing? I didn't hear anything about it after the drama back in the days.


Until I googled it just now, I actually didn't know about this whole drama. I've been using it for the last year and had a really good experience.

(Drama: https://groups.google.com/forum/#!topic/nodejs/Rl3drk9YQ_Q)


Nice to know.

I used it for a project before the drama and switched to vert.x after it.


The age and avatar are not at all synced. Just a heads up if you're gonna be using this outside of testing.


The only one anyone needs - is the list of fake todos, generated using https://github.com/bahmutov/fake-todos

See demo at http://glebbahmutov.com/fake-todos/


"avoid cleaning bird" was in my fake list. I don't know whether it looks disturbing or nonsensical.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: