Skip to content

Latest commit

 

History

History
95 lines (71 loc) · 1.96 KB

05-test-data-seeding.md

File metadata and controls

95 lines (71 loc) · 1.96 KB

🌱 Test Data Seeding

Last Updated: 2026-03-15 | Version: 1.5.0

🎯 Overview

The seed script populates the database with test data for development and testing.


▶️ Running the Seeder

# Reset DB and seed
npm run prisma:seed

# Or (same thing)
npx ts-node prisma/seed.ts

📦 What Gets Seeded

Platforms

All supported platforms:

const platforms = [
  { name: 'GitHub', slug: 'github', category: 'GIT', authType: 'OAUTH' },
  { name: 'LeetCode', slug: 'leetcode', category: 'DSA', authType: 'SCRAPING' },
  { name: 'HackerRank', slug: 'hackerrank', category: 'COMPANY', authType: 'API_KEY' },
  { name: 'Codeforces', slug: 'codeforces', category: 'DSA', authType: 'SCRAPING' },
  // ... 50+ more
];

Test Users

// Test user created by seed
const testUser = await prisma.user.create({
  data: {
    email: 'test@vriddhi-app.vercel.app',
    name: 'Test User',
    password: await bcrypt.hash('TestPass123!', 12),
    isVerified: true,
    isActive: true,
  }
});

Achievements

All 50+ achievement definitions are seeded:

const achievements = [
  { slug: 'first-flame', name: '🔥 First Flame', condition: { streak: 3 } },
  { slug: 'week-warrior', name: '⚡ Week Warrior', condition: { streak: 7 } },
  // ...
];

Subscription Tiers

const tiers = [
  { name: 'FREE', platformLimit: 3, goalLimit: 1 },
  { name: 'STARTER', platformLimit: 10, goalLimit: 5 },
  { name: 'PRO', platformLimit: -1, goalLimit: -1 }, // -1 = unlimited
  // ...
];

🧪 Demo Data for Development

# Create demo entries for testing dashboard
npx ts-node scripts/createDemoData.ts --userId <your-user-id>

This creates:

  • 90 days of tracker entries
  • 5 active goals (various states)
  • 10 earned achievements
  • Connected platforms (GitHub, LeetCode)

📎 Related Docs