---
title: Datafiles
meta:
  description: Datafiles describe your Tinybird resources, like data sources, pipes, and so on. They're the source code of your project.
---

# Datafiles

Datafiles describe your Tinybird resources, like data sources, pipes, and so on. They're the source code of your project.

You can use datafiles to manage your projects as source code and take advantage of version control. Tinybird CLI helps you produce and push datafiles to the Tinybird platform.

## Data projects

A data project is a collection of datafiles that describe your Tinybird resources.

The minimal data project includes:

- A .datasource file, which describes the source and schema of your data.
- A pipe, typically a .endpoint file, which describes how to process and serve the data.

For example:

{% tabs initial="Data source" %}

{% tab label="Data source" %}
```tb
SCHEMA >
    `day` Date `json:$.day`,
    `station` String `json:$.station`,
    `abslevel` Nullable(Float32) `json:$.abslevel`,
    `percentagevolume` Float32 `json:$.percentagevolume`,
    `volume` Float32 `json:$.volume`

ENGINE "MergeTree"
ENGINE_PARTITION_KEY "station"
ENGINE_SORTING_KEY "day, station"
```
{% /tab %}

{% tab label="Pipe" %}
```tb
NODE get_reservoir_levels_data
SQL >
        SELECT
            day,
            volume
        FROM reservoir_levels
        ORDER BY day DESC
        LIMIT 10

TYPE ENDPOINT
```
{% /tab %}

{% /tabs %}

## Folder structure

Tinybird projects are organized in a folder structure that helps you organize the source for each resource type.

The datafiles that you generate when you run `tb init` are organized in the following folders:

- `connections`: Contains [connection files](/forward/dev-reference/datafiles/connection-files).
- `copies`: Contains the [copy pipes](/forward/dev-reference/datafiles/pipe-files#copy-pipes).
- `datasources`: Contains the [data sources](/forward/dev-reference/datafiles/datasource-files).
- `endpoints`: Contains the [endpoint pipes](/forward/dev-reference/datafiles/pipe-files#endpoint-pipes).
- `fixtures`: Contains test fixtures and test data.
- `infra`: Contains the infrastructure files. See [tb infra](/forward/dev-reference/commands/tb-infra).
- `materializations`: Contains [materialized views](/forward/dev-reference/datafiles/pipe-files#materialized-pipes).
- `pipes`: Contains non-published [pipes](/forward/dev-reference/datafiles/pipe-files).
- `sinks`: Contains the [sink pipes](/forward/dev-reference/datafiles/pipe-files#sink-pipes).
- `tests`: Contains the test suites.

The following example shows a typical `tinybird` project folder structure that includes subfolders for supported types:

```txt {% title="Example file structure" %}
.
├── .tinyb
├── connections
├── copies
├── datasources
│   └── user_actions.datasource
├── endpoints
│   ├── user_actions_line_chart.pipe
│   └── user_actions_total_widget.pipe
├── fixtures
│   ├── user_actions.prompt
│   └── user_actions_d1046873.ndjson
├── infra
│   └── aws
│       ├── config.json
│       ├── k8s.yaml
│       └── main.tf
├── materializations
├── pipes
├── sinks
└── tests
    └── user_actions_line_chart.yaml
```

The .tinyb file contains the Tinybird project configuration, including the authentication token obtained by running `tb login`. See [.tinyb file](/forward/dev-reference/datafiles/tinyb-file).

## Types of datafiles

Tinybird uses the following types of datafiles:

- Datasource files (.datasource) represent data sources. See [Datasource files](/forward/dev-reference/datafiles/datasource-files).
- Pipe files (.pipe) represent pipes of various types. See [Pipe files](/forward/dev-reference/datafiles/pipe-files).

## Syntactic conventions

Datafiles follow the same syntactic conventions.

### Casing

Instructions always appear at the beginning of a line in upper case. For example:

```tb {% title="Basic syntax" %}
COMMAND value
ANOTHER_INSTR "Value with multiple words"
```

### Multiple lines

Instructions can span multiples lines. For example:

```tb {% title="Multiline syntax" %}
SCHEMA >
    `d` DateTime,
    `total` Int32,
    `from_novoa` Int16
```

### Comments

You can add comments using the `#` character. For example:

```tb
# This is a comment
COMMAND value
```

## Next steps

- Learn about [datasource files](/forward/dev-reference/datafiles/datasource-files).
- Learn about [connection files](/forward/dev-reference/datafiles/connection-files).
- Learn about [pipe files](/forward/dev-reference/datafiles/pipe-files).
