Datafaker is a Java library that generates realistic fake data for development and demos. It is a maintained fork of java-faker with updated dependencies and additional generators.
Overview
Datafaker generates fake data in Java and Kotlin projects, in the same spirit as common faker libraries in other languages. It helps fill databases, APIs, and user interfaces with plausible sample content while a product is still under construction.
You add it as a Maven or Gradle dependency and call it from application code, JShell, or tooling that embeds Java. Providers cover addresses, names, finance, internet data, entertainment references, and many other domains. Locale and country codes control language-specific output; some fields depend on country rules such as personal IDs or phone numbers.
Beyond single values, Datafaker supports schemas, collections, and streams to shape output. It can emit CSV, JSON, YAML, SQL, TOML, and other formats either from scratch or by transforming existing objects. Unique-value generation and custom providers extend the built-in set.
Recent releases include GraalVM Native Image metadata for built-in providers so native executables can register reflection and classpath resources. The project positions itself as a modern replacement lineage for java-faker, with Java 17 required on current major lines and an older branch for Java 8.
Key features
- Many built-in fake data providers
- Locale and country-aware generation
- Schema-based structured output
- CSV, JSON, YAML, SQL, TOML export
- Custom provider extensions
- GraalVM Native Image metadata
Use cases
- Populating demos with realistic data
- Seeding development databases
- Generating formatted sample exports
- Interactive exploration in JShell