realitydb 0.4.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +88 -47
  2. package/dist/index.js +8772 -2696
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -2,64 +2,116 @@
2
2
 
3
3
  > Production-like data before production exists.
4
4
 
5
- RealityDB is a developer tool that instantly populates your database with
6
- realistic, schema-aware data. One command, realistic environments.
5
+ RealityDB populates your PostgreSQL database with realistic, schema-aware data. Point it at your schema, pick a domain template, and get thousands of rows that look like they came from a real application. Deterministic seeds mean the same command always produces the same data.
7
6
 
8
- ## Install
7
+ ## Quick Start
9
8
 
10
9
  ```bash
11
10
  npm install -g realitydb
11
+
12
+ realitydb scan # Inspect your schema
13
+ realitydb seed --template saas --seed 42 # Populate with realistic data
14
+ realitydb reset --confirm # Clear and start fresh
12
15
  ```
13
16
 
14
- ## Quick Start
17
+ ## Domain Templates
18
+
19
+ | Template | Description | Tables |
20
+ |----------|-------------|--------|
21
+ | `saas` | Subscription business | users, plans, subscriptions, payments |
22
+ | `ecommerce` | Online store | customers, products, orders, order_items |
23
+ | `education` | School system | teachers, classes, students, enrollments, grades, attendance |
24
+ | `fintech` | Financial services | accounts, transactions, fraud_alerts, settlements, chargebacks |
25
+ | `healthcare` | Medical system | patients, providers, encounters, diagnoses, billing |
15
26
 
16
27
  ```bash
17
- realitydb scan # Understand your schema
18
- realitydb seed --seed 42 # Populate with realistic data
19
- realitydb reset --confirm # Clear and start fresh
28
+ realitydb seed --template fintech --records 200 --seed 42
20
29
  ```
21
30
 
22
- Or use npx without installing:
31
+ Each template includes weighted distributions matching real-world data.
23
32
 
24
- ```bash
25
- npx realitydb scan
26
- npx realitydb seed --template saas --records 1000 --seed 42
27
- ```
33
+ ## Key Features
28
34
 
29
- ## Features
35
+ ```bash
36
+ # Timeline generation -- data spanning months
37
+ realitydb seed --template saas --timeline 12-months --seed 42
30
38
 
31
- - **Schema Intelligence** Automatically understands your database structure
32
- - **Domain Templates** SaaS, e-commerce, education with realistic distributions
33
- - **Timeline Generation** — Datasets spanning months with growth curves
34
- - **Scenario Injection** — Payment failures, churn spikes, fraud patterns
35
- - **Reality Packs** — Portable, shareable environment packages
36
- - **Deterministic** — Same seed = same data, every time
39
+ # Scenario injection -- controlled anomalies
40
+ realitydb seed --template saas --scenario payment-failures --scenario-intensity high
37
41
 
38
- ## Templates
42
+ # Environment reproduction -- capture and share
43
+ realitydb capture --name bug-4821
44
+ realitydb load bug-4821.realitydb-pack.json --confirm
39
45
 
40
- ```bash
41
- realitydb seed --template saas --records 1000 --seed 42
42
- realitydb seed --template ecommerce --records 1000 --seed 42
43
- realitydb seed --template education --records 1000 --seed 42
46
+ # CI mode -- JSON output, proper exit codes
47
+ npx realitydb seed --ci --template saas --records 500 --seed 42
44
48
  ```
45
49
 
46
- ## Timeline & Scenarios
50
+ ## Data Science Mode
51
+
52
+ Generate large-scale datasets for ML training, analytics testing, and data pipelines — no database required.
47
53
 
48
54
  ```bash
49
- realitydb seed --template saas --timeline 12-months --seed 42
50
- realitydb seed --template saas --scenario payment-failures --scenario-intensity high
55
+ # Generate 1M rows with default demo schema
56
+ realitydb generate --records 1000000 --format csv
57
+
58
+ # Generate from your SQL schema
59
+ realitydb generate --schema schema.sql --records 100000 --format parquet
60
+
61
+ # Generate from JSON schema with distribution controls
62
+ realitydb generate --schema custom.json --records 500000 --correlations --seed 42
51
63
  ```
52
64
 
53
- ## Reality Packs
65
+ ### Statistical Distributions
54
66
 
55
- ```bash
56
- realitydb pack export --template saas --name my-saas-env --seed 42
57
- realitydb pack import ./my-saas-env.databox-pack.json --confirm
67
+ Define per-column distributions in your JSON schema:
68
+
69
+ ```json
70
+ {
71
+ "tables": [{
72
+ "name": "users",
73
+ "columns": [
74
+ { "name": "age", "type": "integer", "distribution": { "type": "normal", "mean": 35, "stddev": 12, "min": 18, "max": 85 } },
75
+ { "name": "income", "type": "numeric", "distribution": { "type": "log-normal", "mu": 10.5, "sigma": 0.8, "min": 15000, "max": 500000 } },
76
+ { "name": "login_count", "type": "integer", "distribution": { "type": "zipf", "exponent": 1.2, "min": 1, "max": 1000 } }
77
+ ]
78
+ }],
79
+ "correlations": [
80
+ { "source": "age", "target": "income", "coefficient": 0.6 }
81
+ ]
82
+ }
58
83
  ```
59
84
 
85
+ Supported distributions: `normal`, `uniform`, `zipf`, `exponential`, `log-normal`.
86
+
87
+ ### Output Formats
88
+
89
+ | Format | Flag | Description |
90
+ |--------|------|-------------|
91
+ | JSON | `--format json` | NDJSON (newline-delimited JSON), one object per line |
92
+ | CSV | `--format csv` | Standard CSV with headers |
93
+ | Parquet | `--format parquet` | NDJSON with `.parquet.ndjson` extension (convert via DuckDB/pyarrow) |
94
+
95
+ ## Commands
96
+
97
+ | Command | Description |
98
+ |---------|-------------|
99
+ | `realitydb scan` | Inspect database schema |
100
+ | `realitydb seed` | Generate and insert realistic data |
101
+ | `realitydb reset` | Clear seeded data |
102
+ | `realitydb export` | Export data to JSON/CSV/SQL files |
103
+ | `realitydb generate` | Generate large-scale datasets (no DB required) |
104
+ | `realitydb capture` | Snapshot live database into a Reality Pack |
105
+ | `realitydb load` | Load a Reality Pack into the database |
106
+ | `realitydb share` | Display Reality Pack info for sharing |
107
+ | `realitydb pack export` | Generate and export as Reality Pack |
108
+ | `realitydb pack import` | Import a Reality Pack |
109
+ | `realitydb templates` | List available domain templates |
110
+ | `realitydb scenarios` | List available scenarios |
111
+
60
112
  ## Configuration
61
113
 
62
- Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.config.json` for backward compatibility):
114
+ Create `realitydb.config.json`:
63
115
 
64
116
  ```json
65
117
  {
@@ -68,7 +120,7 @@ Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.
68
120
  "connectionString": "postgres://user:pass@localhost:5432/mydb"
69
121
  },
70
122
  "seed": {
71
- "defaultRecords": 5000,
123
+ "defaultRecords": 1000,
72
124
  "batchSize": 1000,
73
125
  "randomSeed": 42
74
126
  },
@@ -76,23 +128,12 @@ Create `realitydb.config.json` (also reads `seedforge.config.json` and `databox.
76
128
  }
77
129
  ```
78
130
 
79
- ## Prerequisites
131
+ ## Requirements
80
132
 
81
133
  - Node.js 20+
82
- - PostgreSQL database
134
+ - PostgreSQL
83
135
 
84
- ## Commands
85
-
86
- | Command | Description |
87
- |---------|-------------|
88
- | `realitydb scan` | Scan and display database schema |
89
- | `realitydb seed` | Generate and insert realistic data |
90
- | `realitydb reset` | Clear seeded data |
91
- | `realitydb export` | Export dataset to JSON/CSV/SQL files |
92
- | `realitydb templates` | List available domain templates |
93
- | `realitydb scenarios` | List available scenarios |
94
- | `realitydb pack export` | Export environment as Reality Pack |
95
- | `realitydb pack import` | Import Reality Pack into database |
136
+ Full documentation: [github.com/emkwambe/databox](https://github.com/emkwambe/databox)
96
137
 
97
138
  ## License
98
139