seed command populates your database with sample data for development and testing. This includes users, posts, comments, and upvotes with realistic content.
Usage
The
seed command automatically runs migrations before seeding. You don’t need to run oforum migrate first.What Gets Created
The seed command generates:30 Users
Demo accounts with usernames like alice, bob, charlie, etc. All use password
password123.20 Posts
Tech-related posts with titles, descriptions, and external URLs covering topics like Go, PostgreSQL, Rust, and web development.
200 Comments
Realistic comment threads including nested replies (30% of comments are replies to other comments).
300 Upvotes
Distributed across posts (60%) and comments (40%) to simulate community engagement.
Output
Default Admin Credentials
The first user created (alice) is automatically assigned admin privileges:
alice
password123
- Access the admin dashboard at
/admin - Manage users, tags, and roles
- Configure site settings
Sample Data
Users
30 users with names:- Use password
password123 - Have random creation dates (up to 90 days in the past)
- Can post, comment, and upvote immediately
Posts
20 posts with realistic tech topics:- “Go 1.25 Released with Major Performance Improvements”
- “SQLite is All You Need”
- “Show: I built a terminal file manager in Rust”
- “Ask: What’s your favorite underrated CLI tool?”
- “Why I Stopped Using React”
- And 15 more…
- Title and body text
- External URL (for 70% of posts)
- Random author from the 30 users
- Creation timestamp (up to 72 days ago)
- Unique slug for URL
Comments
200 comments with varied tones:- “Great article, thanks for sharing.”
- “This mirrors my experience exactly.”
- “Worth noting that this doesn’t work well on Windows.”
- “Bookmarked. Will try this over the weekend.”
- And more…
Upvotes
300 upvotes distributed across:- 60% on posts
- 40% on comments
When to Use Seed Data
Local Development
Perfect for testing features without manually creating content:http://localhost:8080 to see a populated forum.
Staging Environment
Populate staging with realistic data:Demo Instances
Create demo sites for showcasing oForum:Testing
Seed before running integration tests:Seed Variants
The oForum repository includes additional seed scripts in thecmd/ directory for advanced use cases:
seed-extra
Creates 1,000 posts for load testing:- 1,000 posts with procedurally generated titles
- ~2,000 comments (2 per post)
- ~3,000 upvotes (3 per post)
- Uses existing users from
oforum seed
Run
oforum seed first to create the initial 30 users.seed-prod
Creates 5,000 posts for production-scale testing:- 50 users
- 5,000 posts
- ~10,000 comments
- ~15,000 upvotes
- Post tagging (40% of posts)
Idempotency
The seed command usesON CONFLICT DO UPDATE for users, making it safe to run multiple times:
seed multiple times will:
- Keep existing users (updating timestamps)
- Add duplicate posts with different slugs
- Add new comments and upvotes
Resetting Data
To start fresh:Environment Variables
PostgreSQL connection string.
Examples
First-Time Setup
http://localhost:8080 with alice / password123.