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.

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 create are organized in the following folders:

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

Example file structure
.
├── .tinyb
├── copies
├── datasources
│   └── user_actions.datasource
├── endpoints
│   ├── user_actions_line_chart.pipe
│   └── user_actions_total_widget.pipe
├── fixtures
│   ├── user_actions.prompt
│   └── user_actions_d1046873.ndjson
├── materializations
├── sinks
└── tests
    └── user_actions_line_chart.yaml

.tinyb file

The .tinyb file is a configuration file that contains the Tinybird project configuration, including the authentication token obtained by running tb login.

Running commands requires a valid .tinyb file in the root of your project. If you don't have one, you can create one by running tb auth or tb login.

The following is a sample .tinyb file:

Sample .tinyb file
{
    "host": "<tinybird-host>",
    "id": "<workspace-id>",
    "name": "<workspace-name>",
    "scope": "user",
    "token": "<authentication-token>",
    "tokens": {
        "<tinybird-host>": "<authentication-token>",
        "<another-tinybird-host>": "<authentication-token>"
    },
    "user_email": "<user-email>",
    "user_id": "<user-id>",
    "user_token": "<authentication-token>",
    "version": "<tinybird-version>"
}

Types of datafiles

Tinybird uses the following types of datafiles:

  • Datasource files (.datasource) represent data sources. See Datasource files.
  • Pipe files (.pipe) represent pipes of various types. See 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:

Basic syntax
COMMAND value
ANOTHER_INSTR "Value with multiple words"

Multiple lines

Instructions can span multiples lines. For example:

Multiline syntax
SCHEMA >
    `d` DateTime,
    `total` Int32,
    `from_novoa` Int16

Next steps