---
title: Environment Variables
description: "Dokploy allows you to create and manage shared environment variables for your projects."
---

import { Callout } from "fumadocs-ui/components/callout";


## Overview

Shared environment variables allow you to:
- Define values once and use them across multiple services
- Maintain configuration consistency between services
- Centrally manage sensitive information

<ImageZoom src="/assets/images/shared-variables.png" width={800} height={630} alt='Shared variables panel' className="rounded-lg" />

## Practical Example

Let's consider a common scenario where you have:
- A PostgreSQL database
- Two services that need to connect to this database

### 1. Define Shared Variable

In the project's shared variables section, define:

```bash
DATABASE_URL=postgresql://postgres:postgres@database:5432/postgres
```

### 2. Use the Variable in Services

In each service's environment variables tab, reference the shared variable:

```bash
DATABASE_URL=${{project.DATABASE_URL}}
```

<Callout type="info">
  Dokploy will automatically replace `${{project.DATABASE_URL}}` with the value defined in the project's shared variables.
</Callout>

## Best Practices

- Use shared variables for credentials and configurations that repeat across services
- Keep descriptive variable names
- Document the purpose of each variable for easier maintenance


You can use shared enviroment variables in all the services available in dokploy.