This repository contains examples of how to use the hugr platform for various use-cases: setting up data sources, creating GraphQL schemas, and integrating with different services.
The examples run on Docker and Docker Compose.
git clone https://github.com/hugr-lab/examples.git
cd examples
sh scripts/start.shTo stop the environment:
sh scripts/stop.shThe base environment includes:
- PostgreSQL (with TimescaleDB and PostGIS)
- MySQL
- MinIO (S3-compatible object storage)
- Redis
- hugr server
- Prometheus + Grafana (monitoring)
Some examples require additional services started via Docker Compose profiles (see individual example READMEs).
Folder: get-started/
Set up a Northwind database on PostgreSQL and create a GraphQL SDL schema for it. A good starting point for learning hugr basics.
Folder: postgres-examples/
Create an empty PostgreSQL database, describe it in GraphQL SDL, and attach it to hugr as a data source.
Folder: sales/
E-commerce sales system on PostgreSQL with PostGIS geospatial support. Showcases:
- Many-to-many relationships (products ↔ tags)
- Geospatial fields (customer addresses, order locations)
- Composite primary keys
- Time-windowed aggregations (top customers by date range)
Folder: hr-crm/
Human Resources & recruitment management system on MySQL. Showcases:
- MySQL data source configuration
- Complex many-to-many relationships (candidates ↔ skills)
- Pipeline stage tracking (applications → interviews → hiring)
- Aggregations on applications and interview scoring
Folder: mssql/
Microsoft SQL Server with the Adventure Works Lightweight sample database. Showcases:
- MSSQL data source with the
mssql://URI format - DuckDB MSSQL extension with projection and filter pushdown
- Hierarchical data (self-referencing categories)
- Many-to-many relationships (CustomerAddress junction table)
Note: Requires amd64 platform (Intel/AMD processor).
Folder: fabric-warehouse/
Microsoft Fabric Warehouse as a cloud data source via azure:// URI with Azure AD authentication. Showcases:
- Azure AD service principal credentials
@field_sourcedirective for simplifying column names@field_referencesfor star schema relationships- NYC taxi star schema (Date, Trip, Medallion, Geography, Weather)
Note: Requires an active Microsoft Fabric Warehouse instance.
Folder: openweathermap/
Real-time weather data from the OpenWeatherMap REST API. Showcases:
- HTTP data source connector
- OpenAPI specification parsing with
x-hugr-type/x-hugr-nameextensions - Function definitions with SQL expressions
Note: Requires an OpenWeatherMap API key.
Folder: osm/
OpenStreetMap geospatial data (roads, amenities, administrative boundaries). Showcases:
- Self-describing DuckDB data source
- Geospatial queries (intersects, centroid, length measurement)
- Aggregations by administrative boundaries
- S3 object storage integration
Folder: h3/
German census population data with H3 geospatial indexing. Showcases:
- DuckDB data source with H3 extension
- OSM data extension with computed fields
- Geospatial aggregation at different H3 resolutions
Folder: open-payments/
US healthcare Open Payments dataset (~1.3 GB). Showcases:
- Self-describing DuckDB data source
- Time-travel queries
- Large-scale payment analytics
- State/quarter aggregations with reference fields
Folder: ducklake/
DuckLake data source with the NYC Yellow Taxi trip dataset (~36M trips). Showcases:
- Self-describing DuckLake data source (auto-generated GraphQL schema)
- Time-travel queries with
@atdirective across monthly snapshots - Relationships via extension catalog (
trips→zones) - DDL operations (add columns, create tables)
- DuckLake management functions (maintenance, snapshots, metadata views)
- Data stored in MinIO S3, metadata in PostgreSQL
Folder: iceberg/
Apache Iceberg data source with a weather observations dataset. Showcases:
- Apache Polaris as Iceberg REST catalog with OAuth2 authentication
- Self-describing Iceberg data source (auto-generated GraphQL schema)
- Time-travel queries with
@atdirective across monthly snapshots - Namespace-to-module mapping (Iceberg namespaces become GraphQL modules)
- Relationships via extension catalog (observations → weather stations)
- Data stored in MinIO S3
Note: Requires --profile iceberg to start Polaris services: docker compose --profile iceberg up -d