Skip to content

dx: realistic seed data script for local development#393

Merged
0xVida merged 1 commit intoStellar-Fluid:mainfrom
BernardOnuh:dx/realistic-seed-data
Mar 30, 2026
Merged

dx: realistic seed data script for local development#393
0xVida merged 1 commit intoStellar-Fluid:mainfrom
BernardOnuh:dx/realistic-seed-data

Conversation

@BernardOnuh
Copy link
Copy Markdown
Contributor

dx: realistic seed data script for local development

Closes #223

Summary

Extends prisma/seed.ts with a realistic dataset for local development and demo purposes. Working with an empty database makes it impossible to effectively develop and test UI features like charts, tables, and dashboards.

What's seeded

Entity Count Details
Subscription Tiers 3 Free, Pro, Enterprise (unchanged from original)
Demo Tenants 3 Acme DeFi (Pro), Nova Payments (Enterprise), Pebble Wallet (Free)
API Keys 6 2 per demo tenant — Production Key + Sandbox Key
Transactions 1,000 Spread across 30 days, mixed status/chain/category
Webhook Deliveries ~2,500 1–4 delivery attempts per transaction
Spend Baselines 3 30-day rolling averages per demo tenant

Acceptance criteria

  • Creates 3 Tenants, each with 2 API keys
  • Creates 1,000 realistic Transaction records spread across 30 days
  • Creates sample Webhook URLs and delivery logs
  • Runnable via npm run db:seed (already wired in package.json)

Implementation notes

  • Fully backward compatible — the original two test tenants (tenant-test-001, tenant-test-002) and their API keys are preserved unchanged
  • Idempotent — safe to re-run; demo transactions and webhook deliveries are deleted and recreated per tenant, everything else uses upsert
  • Reproducible — uses a seeded PRNG so data distribution is consistent across runs
  • Batched inserts — transactions and webhook deliveries are inserted in batches of 100 to respect SQLite statement limits
  • Follows the existing adapter/logger pattern (PrismaBetterSqlite3, createLogger)

How to test

cd server
npm run db:seed

Expected log output:

Upserted subscription tiers  { tier_count: 3 }
Upserted demo tenants        { tenant_count: 3 }
Created demo API keys        { api_key_count: 6 }
Created 1,000 demo transactions (spread over 30 days)  { tx_count: 1000 }
Created webhook delivery logs  { delivery_count: ~2500 }
Upserted spend baselines     { tenant_count: 3 }
✅ Seeding complete

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@BernardOnuh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@0xVida 0xVida merged commit cca792d into Stellar-Fluid:main Mar 30, 2026
7 of 10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.21.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seed Script: Realistic Dummy Data for Local Dev

2 participants