Skip to content
styopdevPublic

About

AI powered mock data Generator

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

mutit

Prompt-driven mock data generation for PostgreSQL, MySQL, MongoDB, and Redis.

image

Connect to a database, select a table or collection, or enter a Redis key prefix, and describe the data you need. mutit inspects the schema and a small sample of existing records, generates mock rows, and lets you preview them before explicitly inserting them.

Table analysis reports index names, indexed columns, and unique/primary status for PostgreSQL, MySQL, and MongoDB. Requests of 100,000 rows or more show an index-maintenance warning when indexes are present. Indexes are never disabled or modified; unique indexes can still reject generated duplicates.

Run locally

Requirements: Node.js 22.18 or newer.

The client build targets Chrome 87+, Edge 88+, Firefox 78+, and Safari 14.1+. Internet Explorer is not supported.

npm install
npm run dev

Open the Vite URL shown in the terminal (by default http://127.0.0.1:5173). Paste a database connection URI, connect, select a table or collection (or enter a Redis key prefix), analyze it, and enter a prompt. For example:

Generate 1,000 realistic users with English names and unique email addresses.

Hugging Face AI generation

mutit calls the Hugging Face Inference Providers chat-completions API. Create a token with Inference Providers permission from Hugging Face token settings, then enter it in the UI. The default model is Qwen/Qwen2.5-7B-Instruct; you can edit the model ID in the UI or browse available models in the Hugging Face playground.

Free usage depends on Hugging Face and its selected inference provider's current quota and model availability; it is not guaranteed to be unlimited. The selected model receives your prompt, table schema, and up to 8 sample rows retrieved by keyword overlap (not vector embeddings). It generates up to 20 AI seed rows; local expansion draws text and category values from those AI seeds, while typed rules generate values such as numbers, dates, and booleans. This avoids fixed name/brand catalogs, but large jobs can repeat seed categories; it does not call the model once per output row. A generation request returns only a 10-row preview; the full dataset is generated in server-side batches after you confirm insertion.

Explicit enum choices are included in the generation context and enforced for PostgreSQL enum types, MySQL ENUM columns, and MongoDB $jsonSchema enum validators. AI values outside those choices are replaced with allowed values. MongoDB collections without enum validators and Redis targets do not expose enum constraints to mutit.

Large inserts

The UI and API accept up to 1,000,000 rows. After confirmation, mutit generates and sends rows in 5,000-row batches, keeping the full dataset out of the browser and reporting insert progress. PostgreSQL and MySQL batches are committed individually, and Redis batches use MULTI/EXEC; if a later batch fails, earlier batches remain inserted. The current implementation opens and closes a database connection for each batch, so network latency can add noticeable overhead.

This is a supported batch size in the application, not a guarantee that every million-row job will succeed. Actual performance and success depend on the database, row size, indexes, constraints, available resources, and server limits:

  • PostgreSQL supports multi-row INSERT, and mutit caps query parameters at 50,000 (below PostgreSQL's documented 65,535 limit). PostgreSQL recommends COPY for faster large data loads; mutit does not use COPY yet.
  • MySQL supports multi-value INSERT, but each generated statement must fit the server and client max_allowed_packet limits. MySQL 8.4 documents a 64 MB default for the server; a fixed 5,000-row batch can exceed the limit when values are large.
  • MongoDB's Node.js driver batches insertMany() writes; the app sends 5,000 documents per call, below MongoDB's documented 100,000-document write-batch limit. Ordered inserts can partially succeed before an error, and the displayed count may not include documents inserted in the failing batch.
  • Redis supports native strings, hashes, lists, sets, sorted sets, and streams. Analysis samples up to 20 supported keys under the prefix and selects the most common sampled type; new keys use that type. If none are found, the prompt and AI choose a type and data shape. Hash scalar values are stored as strings (nested values as JSON); list and set members, sorted-set members, and stream fields are likewise serialized to strings. Each analysis scans at most 100 SCAN pages. Unsupported Redis module types are skipped, and Redis Cluster is not supported yet.
  • Redis MULTI/EXEC executes each 5,000-row batch as a transaction, but a failed command or lost connection can leave the outcome of that batch uncertain; verify Redis before retrying.

Benchmark with the target database and table before relying on million-row jobs. The project has not yet been tested with a live million-row database insert.

Safety and current scope

  • Database credentials are held only in the browser's in-memory form state and sent to the local API for each request; mutit does not save them.
  • The Hugging Face token is held in browser memory, sent to the local API, and forwarded to Hugging Face as an authorization header for generation; mutit does not save it. The prompt, schema (including index metadata), and selected sample rows are also sent to Hugging Face and its inference provider; do not use this with sensitive production data.
  • Connections are read for table/key-prefix discovery and analysis. Inserts happen only after preview and a separate confirmation.
  • The API binds to 127.0.0.1 by default. Keep it local and use database credentials with only the permissions you need.
  • Preview plans and insert-job state are kept in server memory for up to one hour. Restarting the server loses pending previews and job progress; it does not undo batches already inserted.
  • PostgreSQL and MySQL schemas come from database metadata, even when tables contain no rows. MongoDB uses up to 20 existing documents or a collection's $jsonSchema validator; when neither provides fields, MongoDB and Redis use the prompt and generated seed rows to infer a schema. MongoDB assigns _id on insert when that fallback is used.
  • This is an early MVP: a hosted model generates up to 20 seed rows and schema-aware rules expand them. Review generated data before inserting, especially for tables with unique or custom constraints.

References: PostgreSQL bulk-load guidance, PostgreSQL limits, MySQL insert optimization, MySQL packet limits, MongoDB insertMany(), Redis SCAN, Redis hashes.

Build and run

npm run build
npm start

The production server serves the built web app and API on http://127.0.0.1:3001. Set PORT to change the port and WEB_ORIGIN if the UI is served from a different origin.

About

AI powered mock data Generator

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages