# Postgres

Managed PostgreSQL database instances.

```hcl
postgres "main" {}
```

Reference postgres attributes in env blocks:

```hcl
service "api" {
  build = build.api
  command = "./api"

  endpoint {
    public = true
  }

  env = {
    DATABASE_URL = postgres.main.url
  }
}

postgres "main" {}
```

## Available postgres attributes

- `url` - Full connection string (e.g., `postgres://user:pass@host:5432/dbname`)
- `host` - Database host
- `port` - Database port
- `user` - Database user
- `password` - Database password
- `name` - Database name

---

Related topics:
- Run `specific docs sync` for real-time data synchronization
- Run `specific docs exec` for running migrations
