---
title: Connection files
meta:
   description: Connection files describe your data connections. They're used by Tinybird connectors.
---

# Connection files (.connection)

Connection files describe your data connections. They're used by Tinybird connectors to establish a connection when deploying to live environments. See [Connectors](/forward/get-data-in/connectors).

Connection files bear the .connection extension and are stored in the connections folder of your project. See [Datafiles](/forward/dev-reference/datafiles).

Connection files are not active in the local development environment. When using `tb dev`, connections to external services like Kafka or S3 will not be checked or ingest any data. Connections only become active after deploying to Local or Cloud environments.

## Structure

All .connection file contains a `TYPE` declaration that specifies the type of connection. For each connection type, a number of settings are mandatory.

The name of the .connection file determines the name used in .datasource files when defining the connection.

The following example shows a .connection file for a Kafka data source:

```tb {% title="kafkasample.connection" %}
TYPE kafka
KAFKA_BOOTSTRAP_SERVERS {{ tb_secret("PRODUCTION_KAFKA_SERVERS", "localhost:9092") }}
KAFKA_SECURITY_PROTOCOL SASL_SSL
KAFKA_SASL_MECHANISM PLAIN
KAFKA_KEY {{ tb_secret("PRODUCTION_KAFKA_USERNAME", "") }}
KAFKA_SECRET {{ tb_secret("PRODUCTION_KAFKA_PASSWORD", "") }}
```

The calls to the `tb_secret` function contain the name of the secret and a default value. See [tb secret](/forward/dev-reference/commands/tb-secret) to learn how to set and manage secrets.

{% callout type="caution" %}
Never add credentials as plain text in your datafiles. Use secrets instead.
{% /callout %}

## List your connections

To list your connections, run the [tb connections](/forward/dev-reference/commands/tb-connection) command:

```shell
tb connection ls
```

## Update a connection

To update or refresh a connection after changing settings or secrets, redeploy your project. See [Deployments](/forward/test-and-deploy/deployments). Connections remain active using the previous settings until you deploy them again.