Seeding Demo Data
Learn how to populate CareNova with realistic demo data across all modules for testing and development.
Written By Dev010
Last updated 19 days ago
CareNova includes a comprehensive demo dataset that populates all 19 modules with realistic data. Running the seed script lets you explore the full platform immediately without manually creating any records.
Before You Begin
Make sure the following are completed before seeding:
[ ]
INSTALL.sqlhas been run in Supabase SQL Editor (all tables exist)[ ]
SUPABASE_SERVICE_ROLE_KEYis set in.env.local[ ]
DATABASE_URLis set with port 6543 and?pgbouncer=true[ ] The application runs without errors (
npm run dev)
The seed script requires
SUPABASE_SERVICE_ROLE_KEYto create Supabase Auth users for the demo accounts. Without it, the seed will fail.
Run the Seed Script
Open a terminal inside carenova-app/ and run:
npm run db:seedThe script will output progress as it seeds each table. The full process takes approximately 30β60 seconds depending on your connection speed.
When complete, you will see a confirmation message in the terminal.
What Gets Created
The seed script populates the following data across all modules:
Demo Accounts
The seed script creates four demo user accounts β one for each role:
The default password is
Demo123!. You can customize it by settingDEMO_PASSWORDin your.env.localbefore running the seed:DEMO_PASSWORD=YourCustomPassword1!The password must meet the policy requirements β minimum 8 characters, uppercase, lowercase, number, and special character (
@$!%*?&).
Is the Seed Script Safe to Run Multiple Times?
Yes. The seed script is idempotent β it checks whether data already exists before inserting. Running it multiple times on a database that already has seed data will skip existing records without creating duplicates.
The script uses conditional logic throughout:
If patients already exist β skip patient seeding
If appointments already exist β skip appointment seeding
If expenses already exist β skip expense seeding
And so on for every table
Customizing the Demo Password
Set DEMO_PASSWORD in your .env.local before running the seed:
DEMO_PASSWORD=MySecurePassword1!Then run:
npm run db:seedIf you have already seeded and want to change the demo password, you must reset the database first (see below) before re-seeding with the new password.
Reset and Re-Seed
During development you may want to start fresh with a clean database. Use the full reset command:
npm run setup:dbThis runs the following steps in sequence:
npm run clean # Clear build caches
npm run db:push # Push latest schema to database
npm run db:seed # Seed demo data
Warning: This will clear your
.nextbuild cache and push the schema again. It will not delete existing database records β to fully reset records you must manually truncate tables in Supabase SQL Editor first.
To fully reset all data in Supabase SQL Editor:
-- Run this in Supabase SQL Editor to clear all data
-- WARNING: This deletes everything permanently
TRUNCATE TABLE appointments, patients, invoices,
invoice_items, payments, expenses, prescriptions,
medical_records, medical_record_vitals, clinical_notes,
diagnoses, medical_attachments, odontograms, test_reports,
inventory, staff, lab_vendors, blog_posts, blog_categories,
notifications, departments, services, users
RESTART IDENTITY CASCADE;Then run npm run db:seed again for fresh data.
Verify the Seed
After the seed script completes, verify the data loaded correctly:
Start the development server:
npm run devOpen
http://localhost:3000/loginLog in with
admin@carenova.demo/Demo123!Check the following on the admin dashboard:
[ ] Patient count shows 1,200
[ ] Appointment chart shows data across months
[ ] Revenue chart shows financial data
[ ] Recent appointments table is populated
[ ] Low stock alerts appear in the widget
Navigate to Patients β list should show 1,200 records
Navigate to Appointments β calendar and list should be populated
Navigate to Invoices β mix of paid and unpaid invoices visible
Navigate to Medical Records β vitals and notes visible per patient
Navigate to Inventory β 150 items with stock levels
If all modules show data, the seed was successful. β
Exploring Each Role
Log in with each demo account to explore how the dashboard adapts per role:
Admin β Full access to all modules, financial analytics, revenue charts, overdue invoice alerts, and system settings.
Doctor β Clinical dashboard showing today's appointments, recent patients, and upcoming schedule. Access to medical records, prescriptions, and test reports.
Receptionist β Front desk dashboard showing today's schedule, billing queue, and recent unpaid invoices. Access to appointments and billing modules.
Nurse β Clinical support dashboard showing patient list, today's schedule, and low stock alerts. Access to medical records and inventory.
Troubleshooting
Seed script fails immediately:
Confirm
SUPABASE_SERVICE_ROLE_KEYis set in.env.localConfirm
DATABASE_URLuses port 6543 with?pgbouncer=trueConfirm
INSTALL.sqlhas been run and all tables exist
Demo accounts exist but cannot log in:
Supabase Auth users must be created separately from database users. The seed script creates database records but Supabase Auth user creation requires the service role key to be valid
Check the terminal output for any auth creation errors
Verify the users appear in Supabase β Authentication β Users
Seed completes but dashboard shows no data:
Hard refresh the browser (Cmd+Shift+R / Ctrl+Shift+R)
Check that you are logged in with the correct demo account
Verify the database tables contain records in Supabase β Table Editor
"Already seeded" messages appear for everything:
Your database already has seed data from a previous run
This is expected behavior β the script skipped existing records
If you want fresh data, reset the database first using the SQL above
Next Step
Demo data is now loaded. Continue to the Deployment guide to take CareNova to production, or explore the Dashboard & Modules section to learn how each module works in detail.