anfra docsAlpha
Set up local development

Project structure

How files and folders are organized in an anfra project

An anfra project is a folder of plain files that you keep in Git. Running anfra init creates this layout:

my-project/
├── models/                         # AML data models
├── datasets/                       # AML datasets and their metrics
├── apps/                           # Data apps, one HTML file each
├── .anfra/
│   ├── data_sources.yml            # Warehouse connections, with credentials (git-ignored)
│   ├── data_sources.yml.example    # The same without credentials, to commit
│   ├── context_sources.yml         # What anfra ingest reads for anfra search
│   ├── config.yml                  # Project settings: query defaults, query cache (committed)
│   └── publish/                    # Created by the first pull or publish (git-ignored)
└── .gitignore                      # Ignores .anfra/data_sources.yml

anfra init never changes an existing file, so it is safe to run in a repo that already has some of these.

models/

Each .aml file describes one data model: the mapping between a table (or SQL query) and how anfra should interpret its columns and relationships.

datasets/

Each .aml file describes one dataset: one or more data models joined together, with metrics and dimensions defined on top. Apps query datasets by name.

apps/

Each .html file is one data app. anfra serve lists them by their <title>, and apps/sales/overview.html opens at /apps/sales/overview. Subfolders group apps, and images or scripts next to an app load by relative path.

.anfra/

The project's config folder, committed with it.

  • data_sources.yml holds your warehouse connections. It contains credentials, so anfra init adds it to .gitignore. See Connect your data.
  • data_sources.yml.example is the same file without credentials. Commit it so teammates know what to fill in.
  • context_sources.yml lists the dbt and LookML projects that anfra ingest reads into the local search catalog, alongside the project's own AML. See Ingest.
  • config.yml holds the project's settings, such as query defaults and the query cache. Commit it. See Project settings.
  • publish/ records what this folder last pulled from or published to its organization, and keeps a copy of each file a pull changes, so anfra pull --abort can undo it. anfra creates it on the first pull or publish, with its own .gitignore. Don't edit it. See Publish with your team.

anfra keeps its per-machine state for a project, such as logs, caches and the search catalog, outside the project, under ~/.anfra/repos/.

Organize as you like

Larger projects often nest models and datasets by business domain (for example marketing/models/). anfra finds AML files by their extension, not by folder, so models/ and datasets/ are just the starting point. Apps must stay under apps/.

Next steps

On this page