{"_id":"@alieutech/seedsmith","_rev":"6-73fb0b3e92736893e735deb02b49c823","name":"@alieutech/seedsmith","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.1":{"name":"@alieutech/seedsmith","version":"0.1.1","keywords":["seed","mongodb","mongoose","faker","cli","typescript"],"license":"MIT","_id":"@alieutech/seedsmith@0.1.1","maintainers":[{"name":"alieutech","email":"alieusaidy1999@gmail.com"}],"bin":{"seedsmith":"dist/cli.js"},"dist":{"shasum":"c841da315c089c44dbf1b68bbafc0a181455448b","tarball":"https://registry.npmjs.org/@alieutech/seedsmith/-/seedsmith-0.1.1.tgz","fileCount":13,"integrity":"sha512-V4wt1itN9jyVYyRo1klYpV5x6NBjJyVHKV+9CwIhnFVPI2Pv0kCZiik05PAs9yrGiWNLVb/0Il1+C3YO0daE6g==","signatures":[{"sig":"MEQCIB4fRdgECo82lxUf06hp7Pb4tPpyRotYbOr3i++6Ic2xAiBKclWfVb5z9rSN9QYB4RMX2GYU9ty5Wp0fEg7pIO49Vg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25526},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"scripts":{"test":"jest --config jest.config.cjs --runInBand","build":"tsc","clean":"rm -rf dist","start":"node dist/cli.js","prepare":"npm run build","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"alieutech","email":"alieusaidy1999@gmail.com"},"_npmVersion":"10.9.2","description":"CLI + library to auto-generate MongoDB seed data from Mongoose schemas","directories":{},"_nodeVersion":"22.13.1","dependencies":{"mongoose":"^8.5.2","@faker-js/faker":"^8.4.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.6.3","@types/jest":"^29.5.12","@types/node":"^20.11.30","mongodb-memory-server":"^10.1.4"},"_npmOperationalInternal":{"tmp":"tmp/seedsmith_0.1.1_1765971683412_0.9649954647199759","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@alieutech/seedsmith","version":"0.1.2","keywords":["seed","mongodb","mongoose","faker","cli","typescript"],"license":"MIT","_id":"@alieutech/seedsmith@0.1.2","maintainers":[{"name":"alieutech","email":"alieusaidy1999@gmail.com"}],"bin":{"seedsmith":"dist/cli.js"},"dist":{"shasum":"707d1ba40056a366292f5f44252d03d15331d007","tarball":"https://registry.npmjs.org/@alieutech/seedsmith/-/seedsmith-0.1.2.tgz","fileCount":13,"integrity":"sha512-qV9U/6WOlz5xeuMHjHf3oYOhtkkJJo64ApPaHNhEMRnMx4+LcsSqBGOFvpS6z94tfYEdqDIFO1zT0o90nwdEig==","signatures":[{"sig":"MEUCIQChwkABltBBh7vAdrodh3Ov2YH0WV94n7EpYyrhAgVSlgIgDktr051XYfryE+Zs9GJpz4PNbHVUl5lpREUENYVwl/4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25831},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"gitHead":"42fce534465a1afde255951d0a0b7d78225218f1","scripts":{"test":"jest --config jest.config.cjs --runInBand","build":"tsc","clean":"rm -rf dist","start":"node dist/cli.js","prepare":"npm run build","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"alieutech","email":"alieusaidy1999@gmail.com"},"_npmVersion":"10.9.2","description":"CLI + library to auto-generate MongoDB seed data from Mongoose schemas","directories":{},"_nodeVersion":"22.13.1","dependencies":{"mongoose":"^8.5.2","@faker-js/faker":"^8.4.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.6.3","@types/jest":"^29.5.12","@types/node":"^20.11.30","mongodb-memory-server":"^10.1.4"},"_npmOperationalInternal":{"tmp":"tmp/seedsmith_0.1.2_1766147357743_0.5947789890862101","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@alieutech/seedsmith","version":"0.1.4","description":"CLI + library to auto-generate seed data for MongoDB (Mongoose) and Prisma with realistic fake data","license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js"}},"bin":{"seedsmith":"dist/cli.js"},"scripts":{"build":"tsc","clean":"rm -rf dist","prepare":"npm run build","start":"node dist/cli.js","test":"jest --config jest.config.cjs --runInBand","prepublishOnly":"npm run clean && npm run build"},"keywords":["seed","seeding","mongodb","mongoose","prisma","faker","test-data","fixtures","cli","typescript","orm"],"engines":{"node":">=18"},"publishConfig":{"access":"public"},"dependencies":{"@faker-js/faker":"^8.4.1","mongoose":"^8.5.2"},"devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.30","jest":"^29.7.0","mongodb-memory-server":"^10.1.4","ts-jest":"^29.2.5","typescript":"^5.9.3"},"_id":"@alieutech/seedsmith@0.1.4","gitHead":"690ba369564718653c2a7d7f487add84ff262df3","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-dVHpLrZ8w4xZJSb2CgksSvn4BPge3Rn6M3ifEwLBm7p+idex6RBP1EaSXBeH2YVvAZ2y6onut/ypdtv5jSW+rA==","shasum":"9d8f827b6afb2dc4472c1997849da53e8882fd24","tarball":"https://registry.npmjs.org/@alieutech/seedsmith/-/seedsmith-0.1.4.tgz","fileCount":15,"unpackedSize":39696,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC+RRc2kNIY4npBbesSjwFbnnoHDg1LOZW09HDgDDnzPgIhAN2E9aTQkuLiwNdbOxEQWMhc8rynT/C1bURtYJgVoUg4"}]},"_npmUser":{"name":"alieutech","email":"alieusaidy1999@gmail.com"},"directories":{},"maintainers":[{"name":"alieutech","email":"alieusaidy1999@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/seedsmith_0.1.4_1770139525946_0.7209037779035907"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-17T11:14:18.111Z","modified":"2026-02-03T17:25:26.212Z","0.1.0":"2025-12-17T11:14:18.354Z","0.1.1":"2025-12-17T11:41:23.541Z","0.1.2":"2025-12-19T12:29:17.887Z","0.1.4":"2026-02-03T17:25:26.091Z"},"license":"MIT","keywords":["seed","seeding","mongodb","mongoose","prisma","faker","test-data","fixtures","cli","typescript","orm"],"description":"CLI + library to auto-generate seed data for MongoDB (Mongoose) and Prisma with realistic fake data","maintainers":[{"name":"alieutech","email":"alieusaidy1999@gmail.com"}],"readme":"# SeedSmith\n\n[![CI](https://github.com/alieutech/seedsmith/actions/workflows/ci.yml/badge.svg)](https://github.com/alieutech/seedsmith/actions/workflows/ci.yml)\n[![npm version](https://badge.fury.io/js/@alieutech%2Fseedsmith.svg)](https://www.npmjs.com/package/@alieutech/seedsmith)\n\nA Node.js + TypeScript CLI and library that auto-generates seed data for MongoDB (Mongoose) and Prisma with realistic fake data.\n\n## Features\n\n- 🎭 Uses `@faker-js/faker` to generate realistic values\n- 🔍 Inspects Mongoose schemas automatically\n- 🔗 Handles refs by linking to existing docs or creating stubs\n- 🛡️ Prevents seeding when `NODE_ENV=production`\n- 🔌 Pluggable adapter pattern for multiple ORMs\n- 📦 Built-in adapters: Mongoose, Prisma\n- 🎲 Deterministic seeding via seed option\n- 🔄 Transaction support\n- 🎯 Smart field-name mapping (email, phone, price, etc.)\n\n## Install\n\n```bash\nnpm install @alieutech/seedsmith\n\n# or for CLI usage\nnpm install -g @alieutech/seedsmith\n```\n\n## CLI usage\n\n```bash\n# Basic\nseedsmith --uri mongodb://localhost:27017/mydb --models ./path/to/models --count 25\n\n# Quick start with your Atlas cluster (use environment variable – do NOT hardcode secrets)\nexport MONGO_URI=\"mongodb+srv://<username>:<password>@<cluster-host>/<dbName>?retryWrites=true&w=majority&appName=SeedSmith\"\n\nNODE_ENV=development \\\nseedsmith \\\n  --uri \"$MONGO_URI\" \\\n  --models ./models \\\n  --count 25\n```\n\n# Include/Exclude models\n\nseedsmith --uri mongodb://localhost:27017/mydb --models ./models --include User,Post --exclude Log\n\n# Drop collections before seeding\n\nseedsmith --uri mongodb://localhost:27017/mydb --models ./models --drop\n\n````\n\n### Optional config file\n\nCreate `seed.config.js` in your project root to customize defaults:\n\n```js\n// seed.config.js\nmodule.exports = {\n  docsPerModel: 25,\n  includeModels: [\"User\", \"Post\"],\n  dropBeforeSeed: false,\n  useTransactions: false,\n};\n````\n\n## Library usage\n\n```ts\nimport mongoose from \"mongoose\";\nimport { seedDatabase } from \"@alieutech/seedsmith\";\n\nawait mongoose.connect(\"mongodb://localhost:27017/mydb\");\nawait seedDatabase(mongoose, {\n  // modelsPath: \"./models\", // optional: if omitted, uses already-registered models\n  docsPerModel: 20,\n  includeModels: [\"User\", \"Post\"],\n  dropBeforeSeed: false,\n  useTransactions: false,\n});\nawait mongoose.disconnect();\n```\n\nNote: SeedSmith inspects models that are registered with the Mongoose instance you pass in. If your models live in files (for example `./models/user.js`), require/import them before calling `seedDatabase`, or pass `modelsPath` to automatically load them. Example:\n\n```ts\n// require the model files so they register with mongoose\nrequire(\"./models/user\");\nrequire(\"./models/post\");\n\n// then call seedDatabase\nawait seedDatabase(mongoose, { docsPerModel: 10 });\n```\n\n## Using with Prisma\n\nSeedSmith supports Prisma via the adapter pattern:\n\n```ts\nimport { PrismaClient } from \"@prisma/client\";\nimport { createPrismaAdapter } from \"@alieutech/seedsmith\";\n\nconst prisma = new PrismaClient();\n\nconst adapter = createPrismaAdapter(prisma, {\n  models: [\n    { name: \"user\" }, // model name must match Prisma schema (lowercase)\n    { name: \"post\" },\n    { name: \"comment\", idField: \"commentId\" }, // custom ID field\n  ],\n});\n\n// Note: Currently requires Mongoose for schema extraction\n// Pure Prisma seeding (without Mongoose) coming soon\nawait seedDatabase(mongoose, {\n  adapter,\n  docsPerModel: 10,\n});\n\nawait prisma.$disconnect();\n```\n\n## Advanced Options\n\n```ts\nawait seedDatabase(mongoose, {\n  modelsPath: \"./models\", // auto-load model files\n  docsPerModel: 20, // or { User: 50, Post: 100 }\n  includeModels: [\"User\", \"Post\"], // filter models\n  excludeModels: [\"Log\"], // exclude models\n  dropBeforeSeed: true, // drop collections first\n  useTransactions: true, // wrap in transaction\n  seed: 12345, // deterministic faker seed\n  verbose: true, // detailed logging\n});\n```\n\n## Notes\n\n- SeedSmith throws if `NODE_ENV` is `production`.\n- Models must register themselves with Mongoose (e.g., `mongoose.model('User', userSchema)`).\n- CLI loads `seed.config.js` if present and merges with flags.\n\n## Security\n\n- Never hardcode credentials in code or docs. Prefer environment variables (e.g., `MONGO_URI`) or a secrets manager.\n- Avoid passing credentials directly in shell history. Use `export MONGO_URI=...` or a `.env` file that is not committed.\n- Use a least-privilege database user for seeding (only the necessary permissions for inserts/updates).\n- If credentials were exposed, rotate them immediately and revoke any leaked tokens.\n- Keep seeding to non-production environments; SeedSmith blocks when `NODE_ENV=production`.\n","readmeFilename":"README.md"}