---
title: "Configuration File Reference"
description: "The configuration file allows you to customize how the system interacts with your database. By creating this file, you define where your data structures are stored, where generated files should be ..."
last_updated: "2026-07-02T09:37:14.245198+00:00"
canonical_url: "https://www.doc0.dev/docs/e1b68fed-3c4e-4c95-b2ba-ebf050f78025/guide/configuration/configuration-file-reference"
---

The configuration file allows you to customize how the system interacts with your database. By creating this file, you define where your data structures are stored, where generated files should be saved, and the credentials required to connect to your database.

## Setting Up Your Configuration

To customize your project settings, follow these steps to create and populate your configuration file:

1. Create a file named `drizzle.config.ts` in your main project directory.
2. Define your database connection details and folder preferences using the configuration structure.
3. Save the file to ensure the system recognizes your custom settings.

## Available Configuration Options

The following table outlines the settings you can use to tailor the tool to your project needs:

| Option | Description | Example |
| :--- | :--- | :--- |
| `schema` | Path to your database table definitions | `./src/db/schema.ts` |
| `out` | Folder for generated migration files | `./drizzle` |
| `dialect` | The type of database you are using | `postgresql` |
| `dbCredentials` | Connection details for your database | `{ url: "..." }` |

## Configuration Example

Below is a standard example of how to structure your settings. You can copy this into your project and modify the values to match your specific environment:

```typescript
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/schema.ts',
  out: './migrations',
  dialect: 'postgresql',
  dbCredentials: {
    url: process.env.DATABASE_URL!,
  },
});
```

> [!TIP]
> Use environment variables for your database URL instead of hardcoding sensitive credentials directly into your configuration file.

> [!WARNING]
> Ensure the directory specified in the `out` property exists or is writable by the system, otherwise the migration generation process will fail.

## Understanding Key Concepts

*   **Schema Path:** This tells the tool where to look for your data models. Keeping your schema files organized in a dedicated folder helps maintain a clean project structure.
*   **Migration Files:** These are small, version-controlled instructions that tell the database how to update itself whenever you change your schema.
*   **Dialect:** This identifies the specific database engine you are using (e.g., PostgreSQL, MySQL, or SQLite). Each database has unique requirements, so setting this correctly is essential for proper communication.

> [!IMPORTANT]
> If you change your schema path after creating migrations, the tool may lose track of your database history. Always verify your paths before running migration commands.

## Best Practices for Management

When managing your configuration, keep your file clean and ensure that your database credentials remain secure. Regularly check that the paths defined in your `drizzle.config.ts` match your current project structure to avoid unexpected errors during the migration process.

## Configuration Workflow

The diagram below illustrates how your configuration file dictates the interaction between your code and your database:

```mermaid
graph LR
    A[Configuration File] --> B[Schema Path]
    A --> C[Output Directory]
    A --> D[Database Credentials]
    B --> E[Database Engine]
    D --> E
    E --> F[Migration Files]
```

## Related

- [Managing Schema Migrations](https://www.doc0.dev/docs/e1b68fed-3c4e-4c95-b2ba-ebf050f78025/guide/how-to-guides/managing-schema-migrations)
- [Using Drizzle Studio](https://www.doc0.dev/docs/e1b68fed-3c4e-4c95-b2ba-ebf050f78025/guide/how-to-guides/using-drizzle-studio)


## Sitemap

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