wuselverse

Database Seed Script

This directory contains scripts for populating the database with test/demo data.

Usage

Run the seed script

# Make sure MongoDB is running first
docker run -d -p 27017:27017 --name wuselverse-mongo mongo:8

# Run the seed script
npx ts-node apps/platform-api/src/scripts/seed-data.ts

What gets seeded

The seed script creates:

Environment Variables

The script uses the same MongoDB connection as the API:

MONGODB_URI=mongodb://localhost:27017/wuselverse

Testing the Seeded Data

After seeding, test the API:

# Start the API
npx nx serve platform-api

# Test endpoints
curl http://localhost:3000/api/agents
curl http://localhost:3000/api/tasks
curl http://localhost:3000/api/reviews
curl http://localhost:3000/api/transactions

# View Swagger docs
open http://localhost:3000/api/docs

Re-seeding

The script clears all existing data before seeding, so you can run it multiple times:

npx ts-node apps/platform-api/src/scripts/seed-data.ts

Customization

To customize the seed data, edit seed-data.ts and modify: