Skip to content
Back to Work

Cookiecutter Data Scaffold

A configurable Cookiecutter template for data engineering projects, combining optional batch, streaming, lakehouse and transformation patterns with a reproducible Python stack.

Type

Open source project template

Stack

Python, uv, DuckDB, Airflow, Kafka and dbt

Patterns

Batch, streaming, lakehouse and transformation

Write-up published

Cookiecutter Data Scaffold overview showing its four optional patterns: batch, streaming, lakehouse and transformation

A repeatable starting point

Exploring a new data tool often meant repeating setup work, committing to an architecture too early, or backtracking through a half-finished project. I built this template to make that starting point reproducible: choose the patterns a project needs and generate a working foundation without carrying unused code.

My contribution and the trade-off

I built the template to make repeated project setup reproducible. Its central decision is to compose independent patterns, so choosing a batch pipeline does not force a streaming or lakehouse architecture.

The trade-off is a larger generation test surface: each flag changes files and dependencies. The cleanup manifest makes those changes explicit, rather than asking every generated project to maintain unused code.

Four composable patterns

  • Batch: scheduled or triggered ingestion, with an Airflow DAG and its tests.
  • Streaming: a continuous ingestion consumer with sinks and test coverage.
  • Lakehouse: a local DuckDB storage layer that batch and streaming pipelines can write into.
  • Transformation: a dbt project with a local DuckDB target, usable independently of the lakehouse pattern.

Only enabled patterns appear in the generated project. Disabling streaming removes its folders and dependencies rather than leaving commented-out code or placeholder branches.

Keeping the template honest

The generation hook owns a manifest of pattern flags, files to remove, and surviving files whose content depends on each flag. A test cross-checks this manifest against the template tree, so a new conditional file cannot be added without its cleanup behaviour being accounted for.

The shared sink supports batch and streaming. With the lakehouse enabled it writes through DuckDB; without it, PyArrow writes Parquet files directly. This keeps the generated project usable across different combinations of patterns.

A local development stack

uv manages environments and locked dependencies. Airflow handles batch scheduling, Kafka supplies the streaming demo, and dbt-duckdb provides transformations against a local file. Ruff, pytest and pre-commit supply the engineering checks for the selected patterns.

Python 3.12 or later and uv are required. Docker is optional, for running the Airflow and Kafka demo infrastructure locally.

Generate a project

This example generates the default patterns in example_data_project. Omit --no-input to choose the project name, author and patterns interactively.

Bash
uv venv
source .venv/bin/activate
uv pip install cookiecutter
cookiecutter gh:vincyf1/cookiecutter-data-scaffold --no-input project_slug=example_data_project

Inside the generated project, sync its dependencies and run its tests:

Bash
cd example_data_project
uv sync
uv run pytest

The installation guide covers template variables, version overrides and troubleshooting.

Where the scaffold stops

The local stack is a starting point for development. A generated project still needs workload-specific decisions about deployment, access, secrets, monitoring and recovery before it can serve production traffic.

For another view of those operational decisions, see my self-hosted AI assistant architecture or engineering background.