High-performance database generator with realistic fake data
Generate databases from JSON schemas with realistic fake data. 10-50x faster than pure Python/JavaScript implementations thanks to a Go core with zero-dependency wrappers for Python and Node.js.
- π Schema-Driven - Define tables and data in simple JSON format
- β‘ High Performance - Go core delivers 10-50x speed improvement
- π‘ Realistic Data - 116+ generators covering financial, localization, products, animals, food, vehicles, books, and more
- π¨ Custom Patterns - Template generator for custom data formats (SKUs, IDs, codes, license plates)
- π― Interactive Generator - Built-in schema generator with 10 pre-built templates
- ποΈ Multi-Database - Works with SQLite, MySQL, PostgreSQL, MariaDB, MS SQL Server, CockroachDB
- π― Simple API - Easy CLI and programmatic usage
- π Cross-Platform - Linux, macOS, Windows (amd64 & arm64)
- π¦ Multi-Ecosystem - Available on PyPI, npm, and Homebrew
- π§ Zero Dependencies - Self-contained with bundled binaries
Choose your preferred package manager:
Python (pip) - Requires Python >= 3.8
pip install fakestackNode.js (npm)
npm install fakestackHomebrew (macOS/Linux)
brew install 0xdps/fakestackGo (from source)
cd golang && go buildDirect Download
Pre-built binaries available on GitHub Releases
Use the built-in interactive generator:
fakestack -g .
# or specify output filename
fakestack -g my-schema.jsonChoose from 10 pre-built templates:
- Users - Basic user management
- Employees - Employee records with departments
- Products - E-commerce products
- Orders - Order management system
- Customers - Customer database
- Blog Posts - Content management
- Inventory - Stock management
- Transactions - Financial records
- Students - Educational records
- Tasks - Task management
Or download a basic example:
fakestack -d .# All in one command
fakestack -c -p -f schema.json
# Or separately
fakestack -c -f schema.json # Create tables
fakestack -p -f schema.json # Populate datasqlite3 test.db "SELECT * FROM users LIMIT 5;"fakestack [OPTIONS]
Options:
-c, --create-table Create database tables from schema
-p, --populate-data Populate tables with fake data
-f, --file <path> Path to JSON schema file
-g, --generate <file> Generate schema interactively (use '.' for default filename)
-d, --download-schema Download example schema
-v, --version Show version information
-h, --help Display help messagefrom fakestack import fakestack
# Generate database
exit_code = fakestack(['-c', '-p', '-f', 'schema.json'])
# Or use run_fakestack
from fakestack import run_fakestack
run_fakestack(['-d', '.']) # Download schema
run_fakestack(['-c', '-p', '-f', 'schema.json']) # Generate// CommonJS
const { fakestack } = require('fakestack');
// ES Modules
import { fakestack } from 'fakestack';
// Generate database
await fakestack(['-c', '-p', '-f', 'schema.json']);
// TypeScript with options
import { fakestack, FakestackOptions } from 'fakestack';
const options: FakestackOptions = {
createTables: true,
populateData: true,
schemaFile: 'schema.json'
};
await fakestack(options);Create a schema.json file defining your database structure:
{
"database": {
"dbtype": "sqlite",
"drivername": "sqlite",
"database": "test.db"
},
"tables": [
{
"name": "users",
"columns": [
{
"name": "id",
"type": "integer",
"options": {"primary_key": true, "autoincrement": true}
},
{
"name": "username",
"type": {"name": "string", "args": {"length": 50}},
"options": {"nullable": false, "unique": true}
},
{
"name": "email",
"type": {"name": "string", "args": {"length": 100}},
"options": {"nullable": false, "unique": true}
},
{
"name": "created_at",
"type": "datetime",
"options": {"nullable": false}
}
]
}
],
"populate": [
{
"name": "users",
"count": 100,
"fields": [
{"name": "username", "generator": "user_name"},
{"name": "email", "generator": "email"},
{"name": "created_at", "generator": "past_date"}
]
}
]
}first_name,last_name,nameemail,user_name,passwordphone_number,ssn,ein
address,street_addresscity,state,country,country_codepostcode,latitude,longitudetimezone,language,locale
credit_card,credit_card_type,credit_card_cvv,credit_card_expcurrency,currency_long,pricebitcoin_address,bitcoin_private_keyiban,routing_number
company,company_suffixjob,catch_phrase
url,domain_name,slugipv4,ipv6,mac_addressuser_agent,chrome_user_agent,firefox_user_agent,safari_user_agent,opera_user_agentapp_name,app_version,app_author
date,date_time,timestamppast_date,future_datetime,unix_timeyear,month,month_string,weekday
text,sentence,paragraphword,wordsquote,phrase,questionemoji,emoji_description,emoji_category
random_int,integer(with min/max range)random_digit,random_numberrandom_float,float,decimal(with min/max range)
product_name,product_category,product_description,product_featurecolor,hex_color,safe_colorprice
filename,file_extension,mime_typeimage_url
book_title,book_author,book_genremovie_name,movie_genre
animal,animal_type,pet_namecat,dog,bird,farm_animal
fruit,vegetablebreakfast,lunch,dinner,snack,dessertdrink
car_maker,car_model,car_typecar_fuel_type,car_transmission_type
person- Complete person objectuser- User credentials objectrandom_from- Pick from provided listuuid- Generate UUIDtemplate- Custom patterns with modifiers
| Database | Driver | Connection String Example |
|---|---|---|
| SQLite | sqlite |
sqlite:///path/to/database.db |
| MySQL | mysql+mysqlconnector |
mysql+mysqlconnector://user:pass@host/db |
| PostgreSQL | postgresql+psycopg2 |
postgresql+psycopg2://user:pass@host/db |
| MariaDB | mysql+mysqlconnector |
mysql+mysqlconnector://user:pass@host/db |
| MS SQL Server | mssql+pyodbc |
mssql+pyodbc://user:pass@host/db |
| CockroachDB | postgresql+psycopg2 |
postgresql+psycopg2://user:pass@host:26257/db |
{
"database": {
"dbtype": "sqlite",
"drivername": "sqlite",
"database": "myapp.db"
}
}{
"database": {
"dbtype": "mysql",
"drivername": "mysql+mysqlconnector",
"username": "root",
"password": "password",
"host": "localhost",
"port": 3306,
"database": "myapp"
}
}{
"database": {
"dbtype": "postgresql",
"drivername": "postgresql+psycopg2",
"username": "postgres",
"password": "password",
"host": "localhost",
"port": 5432,
"database": "myapp"
}
}Create custom data formats using the template generator:
{
"name": "sku",
"generator": "template",
"args": {
"pattern": "{{word|upper|truncate(3)}}-{{random_int(1000,9999)}}"
}
}Output: PRD-4821, INV-9234, STO-1456
More Examples:
{"pattern": "EMP-{{random_int(10000,99999)}}"} // EMP-45678
{"pattern": "{{uuid|upper|truncate(8)}}"} // A1B2C3D4
{"pattern": "{{city}}, {{state}} {{postcode}}"} // San Francisco, CA 94102
{"pattern": "{{car_maker}}-{{car_model|upper}}"} // Toyota-CAMRY
{"pattern": "{{country_code}}-{{random_int(100,999)}}"} // US-432Supported Modifiers: upper, lower, title, trim, truncate(n)
π Template Examples - Comprehensive examples
π Custom Generators Guide - Full guide with advanced patterns
π Full Documentation on ReadTheDocs - Complete documentation with examples and tutorials
- Getting Started - Installation and basic usage
- Schema Reference - Complete schema documentation
- Data Generators - All available data generators
- Custom Generators - Template generator guide
- Database Support - Database-specific configuration
- API Reference - Python and Node.js APIs
- Examples - Real-world examples
- Troubleshooting - Common issues and solutions
- Python Package - Python-specific documentation
- Node.js Package - Node.js/TypeScript documentation
- Go Core - Go core documentation
Fakestack's Go core delivers exceptional performance:
| Dataset | Python v2.0 | Go Core v2.1 | Speedup |
|---|---|---|---|
| 1K rows | ~2.5s | ~0.1s | 25x |
| 10K rows | ~25s | ~0.8s | 31x |
| 100K rows | ~250s | ~6s | 42x |
Benchmarks run on: MacBook Pro M1, 16GB RAM, SQLite database
fake-stack/
βββ golang/ # Go core implementation
β βββ *.go # Source files
β βββ Formula/ # Homebrew formula
β βββ README.md # Go documentation
βββ python/ # Python package (PyPI: fakestack)
β βββ fakestack/ # Python module
β βββ tests/ # Integration tests
β βββ README.md # Python documentation
βββ node/ # Node.js package (npm: fakestack)
β βββ src/ # TypeScript source
β βββ tests/ # Integration tests
β βββ README.md # Node.js documentation
βββ docs/ # Documentation
βββ bin/ # Compiled binaries
βββ scripts/ # Build scripts
Contributions welcome! See CONTRIBUTING.md for guidelines.
Go Core:
cd golang
go mod download
go build
go test -v ./...Python:
cd python
pip install -e ".[dev]"
pytest tests/ -v
black fakestack/Node.js:
cd node
npm install
npm test
npm run build# Go tests
cd golang && go test -v ./...
# Python tests (all versions: 3.8-3.13)
cd python && pytest tests/ -v
# Node.js tests (Node 18+)
cd node && npm testMIT License - see LICENSE file for details.
Built with:
- gofakeit - Go fake data generation
- go-sqlite3 - SQLite driver
- go-mysql-driver - MySQL driver
- pq - PostgreSQL driver
- οΏ½ Documentation: ReadTheDocs
- οΏ½π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π¦ PyPI: https://pypi.org/project/fakestack/
- π¦ npm: https://www.npmjs.com/package/fakestack
- πΊ Homebrew:
brew tap 0xdps/packages && brew install fakestack
See CHANGELOG.md for version history and release notes.
Made with β€οΈ by Devendra Pratap