> ## Documentation Index
> Fetch the complete documentation index at: https://backdrift.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Seed Data

> Populate your database with realistic test data.

Seed data helps you test your application with realistic content. Backdrift generates contextual seed data based on your entity schemas.

## Seeding from the Dashboard

1. Go to your project's **Admin** tab
2. Click **Seed Data**
3. Select a profile
4. Click **Seed**

## Seed Profiles

### Minimal

A small dataset for quick testing:

* 1-2 users per role
* 3-5 records per entity
* Basic relationships

**Use for:** Quick feature testing, demos

### Realistic

A production-like dataset:

* 10-20 users
* 50-100 records per entity
* Complex relationships
* Varied data (different statuses, priorities, dates)

**Use for:** User acceptance testing, screenshots, demos

### Stress Test

Large volume for performance testing:

* 100+ users
* 1,000+ records per entity
* Edge cases (very long text, special characters)

**Use for:** Performance testing, pagination testing

## Smart Data Generation

Backdrift generates contextually appropriate data based on field names and types:

| Field                | Generated Data            |
| -------------------- | ------------------------- |
| `email`              | Realistic fake emails     |
| `name`, `first_name` | Common names              |
| `phone`              | Valid phone formats       |
| `address`            | Real-looking addresses    |
| `title` (on Task)    | Task-like titles          |
| `description`        | Lorem-style paragraphs    |
| `price`              | Reasonable dollar amounts |
| `created_at`         | Recent dates              |
| `due_date`           | Future dates              |

### Enums

For enum fields, data is distributed realistically:

* `status`: 40% pending, 40% active, 20% done
* `priority`: 20% low, 50% medium, 30% high

### Relationships

Seed data maintains referential integrity:

* Tasks are assigned to existing projects
* Comments belong to existing tasks
* Users are linked to organizations

## Multi-Tenant Seeding

In multi-tenant mode, seed data creates:

* Multiple organizations
* Users per organization
* Isolated data per tenant

Example distribution:

```
Acme Corp (org-1)
├── 5 users
├── 3 projects
└── 15 tasks

Beta Inc (org-2)
├── 3 users
├── 2 projects
└── 10 tasks

Gamma LLC (org-3)
├── 4 users
├── 4 projects
└── 20 tasks
```

## API Seeding

Seed programmatically via API:

```bash theme={null}
POST /projects/{projectId}/seed
Authorization: Bearer $TOKEN
Content-Type: application/json

{
  "profile": "realistic",
  "options": {
    "clearExisting": false,
    "organizationCount": 3,
    "usersPerOrg": 5
  }
}
```

### Options

| Option              | Type    | Default   | Description                           |
| ------------------- | ------- | --------- | ------------------------------------- |
| `profile`           | string  | "minimal" | minimal, realistic, stress            |
| `clearExisting`     | boolean | false     | Delete existing data first            |
| `organizationCount` | number  | 3         | Number of tenants (multi-tenant only) |
| `usersPerOrg`       | number  | 5         | Users per organization                |

## Custom Seed Data

For specific test scenarios, create records manually:

1. Use the **Data Browser** to create records
2. Export as JSON (coming soon)
3. Import to reset to that state

## Clearing Data

To reset your database:

1. Go to **Admin** tab
2. Click **Clear Data**
3. Select entities to clear
4. Confirm deletion

<Warning>
  Clearing data is permanent. In production, consider using a separate test environment instead.
</Warning>

## Test Credentials

Seeded users have predictable credentials:

| Email                                           | Password     | Role   |
| ----------------------------------------------- | ------------ | ------ |
| [admin@example.com](mailto:admin@example.com)   | TestPass123! | admin  |
| [member@example.com](mailto:member@example.com) | TestPass123! | member |
| [viewer@example.com](mailto:viewer@example.com) | TestPass123! | viewer |

<Note>
  These are for testing only. In production, use real user signups.
</Note>

## Best Practices

<AccordionGroup>
  <Accordion title="Use Separate Environments">
    Seed test data in dev/staging, not production.
  </Accordion>

  <Accordion title="Reset Before Demos">
    Clear and re-seed before important demos for clean data.
  </Accordion>

  <Accordion title="Test Edge Cases">
    The Stress Test profile includes edge cases—use it to find bugs.
  </Accordion>

  <Accordion title="Check Relationships">
    After seeding, verify relationships are correct in the Data Browser.
  </Accordion>
</AccordionGroup>
