---
title: "Seeding Mock Data"
description: "Seeding mock data allows you to fill your database with realistic, automatically generated information. This is particularly useful during the development and testing phases, as it lets you interac..."
last_updated: "2026-07-02T09:37:14.192732+00:00"
canonical_url: "https://www.doc0.dev/docs/e1b68fed-3c4e-4c95-b2ba-ebf050f78025/guide/how-to-guides/seeding-mock-data"
---

Seeding mock data allows you to fill your database with realistic, automatically generated information. This is particularly useful during the development and testing phases, as it lets you interact with your application using a populated database without needing to manually enter dozens of records.

By using the seeding tool, you can create consistent datasets that mirror real-world usage, ensuring your features work as expected before moving to production.

## How to Seed Your Database

Follow these steps to populate your database with mock data:

### Step 1: Define your data structure
Specify the tables or entities you want to populate with information.

### Step 2: Choose your data generators
Select the types of mock data you need, such as names, email addresses, dates, or custom values.

### Step 3: Execute the seeding command
Run the process to inject the generated information into your database.

### Step 4: Verify the results
Open your application or database browser to confirm that the new records appear as expected.

## Key Concepts

*   **Mock Data:** Fake but realistic-looking data used to simulate production information.
*   **Data Generator:** A pre-built function that automatically creates specific types of content, such as random phone numbers, addresses, or user profiles.
*   **Database Schema:** The blueprint of your database that defines how your data is organized; the seed tool uses this to understand where to place the generated information.

## Configuration Options

You can configure your seed process to generate various types of data. The table below outlines common options you might use when setting up your mock data.

| Data Type | Description |
| :--- | :--- |
| String | Generates random text, names, or addresses |
| Number | Generates random integers or decimal values |
| Boolean | Randomly toggles between true and false |
| Date | Generates random timestamps within a range |
| Relationship | Creates connections between linked records |

## Best Practices and Warnings

> [!NOTE]
> Seeding is intended for development and staging environments. Be careful not to run seeding commands against a production database, as this may overwrite or corrupt your actual user data.

> [!TIP]
> Use the "Relationship" feature to generate connected data, such as assigning a set of generated posts to a specific generated user. This creates a more authentic testing environment.

> [!WARNING]
> If you have existing data in your tables, ensure your seed process is configured to add to the data rather than replacing it entirely, unless you intend to clear the database first.

> [!IMPORTANT]
> Always review your seed configuration if your database structure changes. If you add a new required field to a table, your existing seed scripts may need to be updated to include that field, or the seeding process will fail.

## Seeding Workflow

The following diagram illustrates how the seed tool interacts with your database.

```mermaid
graph LR
    A[Define Data Requirements] --> B[Run Seeding Command]
    B --> C{Database}
    C --> D[Realistic Test Data Populated]
```

## Troubleshooting Common Issues

If you encounter issues during the seeding process, consider the following checklist:

*   **Connection errors:** Ensure your database service is running and accessible.
*   **Missing fields:** Check that all required fields in your database table have a corresponding generator in your seed configuration.
*   **Constraint violations:** Ensure that any generated data adheres to your table's constraints (such as unique email addresses).

## Related

- [Quickstart Guide](https://www.doc0.dev/docs/e1b68fed-3c4e-4c95-b2ba-ebf050f78025/guide/getting-started/quickstart-guide)


## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/e1b68fed-3c4e-4c95-b2ba-ebf050f78025/llms.txt) for all pages in this wiki.
