Skip to main content

Overview

The SkillRise seed script (server/seed.js) populates the database with realistic demo data including:
  • 10 users (7 educators, 3 students)
  • 10 courses across various categories (Web Dev, Data Science, UI/UX, DevOps, etc.)
  • 19 purchases (students enrolled in courses)
  • 19 course progress records (tracking lecture completion)
  • 15 quizzes with multiple-choice questions
  • 4 community groups (Web Development, Data Science, UI/UX, Career)
  • 12 discussion posts with upvotes
  • 18 threaded replies
Safe to re-run: The seed script clears existing seeded data before inserting new records. Your production data remains untouched.

Prerequisites

1

Complete installation

Ensure you’ve completed Installation and Configuration.
2

Database connection

Verify MongoDB is running and MONGODB_URI is configured in server/.env.
3

Dependencies installed


Running the Seed Script

Run Seed Script Locally

1

Navigate to server directory

2

Run seed command

Or directly:
3

Verify output

You should see:
Seeding complete! Your database now has demo data.

Seeded Data Details

Users

The seed script creates 10 users with realistic profiles:
Brad Traversy
user_seed_educator1
brad@traversymedia.com
Corey Schafer
user_seed_educator2
corey@coreyms.com
Nana Janashia
user_seed_educator3
nana@techworld-with-nana.com
Gary Simon
user_seed_educator4
gary@designcourse.com
Jeff Delaney
user_seed_educator5
jeff@fireship.io
Gaurav Sen
user_seed_educator6
gaurav@gauravsen.com
Chuck Keith
user_seed_educator7
chuck@networkchuck.com
server/seed.js:21-70

Courses

The seed script creates 10 comprehensive courses with real video URLs:

Full-Stack Web Development

Educator: Brad Traversy
Price: ₹3,999 (30% off)
Chapters: 3 | Lectures: 8 | Duration: 177 min
Students: 37

Data Science & ML

Educator: Brad Traversy
Price: ₹4,499 (20% off)
Chapters: 2 | Lectures: 5 | Duration: 120 min
Students: 42

UI/UX Design

Educator: Corey Schafer
Price: ₹2,999 (15% off)
Chapters: 2 | Lectures: 5 | Duration: 115 min
Students: 27

TypeScript Masterclass

Educator: Jeff Delaney
Price: ₹2,499 (20% off)
Chapters: 2 | Lectures: 5 | Duration: 104 min
Students: 32

DevOps with Docker & K8s

Educator: Nana Janashia
Price: ₹3,499 (25% off)
Chapters: 2 | Lectures: 5 | Duration: 128 min
Students: 30

React Native

Educator: Jeff Delaney
Price: ₹3,299 (10% off)
Chapters: 2 | Lectures: 5 | Duration: 104 min
Students: 24
server/seed.js:104-213
All courses use real educational YouTube videos. Video URLs point to actual tutorials (not placeholders).

Quizzes

Each course chapter includes a quiz with 2-3 questions:
server/seed.js:1349-1384
Total: 15 quizzes across all course chapters.

Community Groups

Four official community groups for discussions:

🌐 Web Development

128 members
HTML, CSS, JavaScript, React, Node.js

🤖 Data Science & AI

94 members
ML, data analysis, Python, AI

🎨 UI/UX Design

76 members
Design systems, Figma, user research

💼 Career & Jobs

210 members
Resume tips, interviews, job hunting
server/seed.js:910-951

Purchases & Progress

  • 19 completed purchases linking students to courses
  • 19 course progress records tracking which lectures each student has completed
  • Realistic progress percentages (some courses 100% complete, others partially watched)
server/seed.js:1038-1047
server/seed.js:1216-1223

Seed Script Deep Dive

How It Works

The seed script follows this flow:
1

Connect to database

server/seed.js:7-9
2

Clear existing seed data

server/seed.js:959-969
Only deletes records with _id starting with user_seed_ or educatorId matching seed educators. Your real data is safe.
3

Insert users

server/seed.js:972-974
4

Insert courses

server/seed.js:977-979
5

Update users with enrolled courses

server/seed.js:995-1007
6

Insert purchases, progress, quizzes, groups, posts, replies

Each collection is populated sequentially with insertMany().

Source Code Location

The seed script is located at:
Key sections:
  • Lines 21-92: User data
  • Lines 104-906: Course data (10 courses with full content)
  • Lines 908-951: Community group data
  • Lines 955-1700+: Main seed function
server/seed.js:1-18

Customizing Seed Data

To modify the seed data:
1

Open seed.js

2

Modify data arrays

Edit the data arrays at the top of the file:
3

Re-run seed script


Verify Seeded Data

Using MongoDB Shell

Using the Application

1

Start the application

2

Browse seeded content

  1. Open http://localhost:5173
  2. Navigate to Courses → See 10 seeded courses
  3. Navigate to Community → See 4 groups
  4. Sign up with Clerk → Your account is separate from seed data
Seed data uses hardcoded IDs like user_seed_educator1. Real users from Clerk will have different IDs (e.g., user_2abc...).

Resetting Data

To clear all seeded data:
The seed script automatically clears existing seed data before inserting new records:

Troubleshooting

Symptom: Script runs but never completesSolutions:
  1. Check MongoDB connection:
  2. Verify MONGODB_URI in server/.env
  3. Increase connection timeout:
    server/configs/mongodb.js
Error: E11000 duplicate key error collection: SkillRise.users index: _id_ dup keyCause: Seed data already exists in the database.Solutions:
  1. The seed script should auto-clear. Verify lines 959-969 in seed.js
  2. Manually delete conflicting records (see Resetting Data)
Symptom: Seed completes successfully but app shows no coursesSolutions:
  1. Verify you’re connected to the correct database:
  2. Check that courses are marked as published:
  3. Restart the server:
Symptom: Courses load but lecture videos show “Video unavailable”Cause: YouTube URLs may be region-restricted or removed.Solutions:
  1. This is expected for demo data (videos are real but may have geo-restrictions)
  2. Replace with your own video URLs in seed.js:104-906
  3. Use a different video platform (Cloudinary, Vimeo, etc.)

Production Considerations

Never run the seed script in production. It’s intended for development and testing only.

Safe Production Data Loading

For production, use migration scripts instead:
1

Create migration script

server/migrations/001-initial-courses.js
2

Run migration

Consider using a migration tool like migrate-mongo for production deployments.

Next Steps

Start Development

Run SkillRise locally with seeded data

Database Schema

Understand the data models

API Endpoints

Explore the REST API