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.sql has been run in Supabase SQL Editor (all tables exist)

  • [ ] SUPABASE_SERVICE_ROLE_KEY is set in .env.local

  • [ ] DATABASE_URL is set with port 6543 and ?pgbouncer=true

  • [ ] The application runs without errors (npm run dev)

The seed script requires SUPABASE_SERVICE_ROLE_KEY to 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:seed

The 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:

Table

Records

Description

Clinics

1

Default general clinic configuration

Departments

11

General Medicine, Dental, Cardiology, and more

Users

4

One demo account per role

Patients

1,200

Full profiles with demographics and medical history

Appointments

1,697

Spread across past and future dates

Invoices

1,393

Mix of paid, unpaid, and cancelled

Invoice Items

1,393

Line items linked to invoices

Payments

400

Recorded against invoices

Expenses

94

Departmental expenses by category

Prescriptions

199

Linked to patients and doctors

Medical Records

300

Visit records with vitals and notes

Vitals

266

Blood pressure, heart rate, temperature, BMI

Clinical Notes

249

Doctor and nurse notes per visit

Diagnoses

348

With ICD codes and active/resolved status

Medical Attachments

175

File references per patient

Odontograms

125

Dental charts for dental clinic type

Test Reports

50

Lab results with reference values

Laboratory Tests

14

Test definitions with categories

Test Categories

10

Lab test category groups

Test Methodologies

10

Lab methodology definitions

Sample Types

8

Collection and storage specifications

Turnaround Times

5

SLA definitions for lab tests

Lab Vendors

10

External lab suppliers

Inventory

150

Medical supplies with stock levels

Staff

12

Staff roster with schedules

Blog Posts

12

Mix of published and draft articles

Blog Categories

9

Categorized by medical specialty

Notifications

20

Mixed read and unread notifications

Demo Accounts

The seed script creates four demo user accounts β€” one for each role:

Role

Email

Password

Admin

admin@carenova.demo

Demo123!

Doctor

doctor@carenova.demo

Demo123!

Receptionist

receptionist@carenova.demo

Demo123!

Nurse

nurse@carenova.demo

Demo123!

The default password is Demo123!. You can customize it by setting DEMO_PASSWORD in your .env.local before 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:seed

If 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:db

This 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 .next build 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:

  1. Start the development server: npm run dev

  2. Open http://localhost:3000/login

  3. Log in with admin@carenova.demo / Demo123!

  4. 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

  5. Navigate to Patients β€” list should show 1,200 records

  6. Navigate to Appointments β€” calendar and list should be populated

  7. Navigate to Invoices β€” mix of paid and unpaid invoices visible

  8. Navigate to Medical Records β€” vitals and notes visible per patient

  9. 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_KEY is set in .env.local

  • Confirm DATABASE_URL uses port 6543 with ?pgbouncer=true

  • Confirm INSTALL.sql has 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.