Reporting & BI
How to feed a dashboard or a data warehouse with a business’s operation running on R2.
To build your own dashboards or load a data warehouse, the path is to read orders and payments in date blocks and store them on your side. With read:orders, read:payments and read:items you have what you need to compute almost any metric.
Metrics you can derive#
| Metric | How to build it |
|---|---|
| Revenue per period | Sum of total from non-cancelled orders, grouped by date. |
| Average rate | Lodging revenue divided by nights sold, taken from the lines. |
| Channel mix | Orders grouped by channel. |
| Payment method mix | Collected payments grouped by method. |
| Best sellers | Order lines aggregated by item_name. |
| Returning customers | Customer directory filtered by visit_count. |
Block loading#
For the initial historical load, go month by month instead of requesting everything at once: it stays well within the limits and lets you retry a single month if something fails.
// Initial load: one month at a time
for (const [from, to] of monthsBetween("2025-01-01", "2026-07-31")) {
const orders = await readAll("orders", {
created_from: from,
created_to: to,
});
await saveToWarehouse(orders);
console.log(from, "→", orders.length, "orders");
}Does a report already solve this?
Before building dashboards from scratch, check whether the business already has what it needs inside R2: the platform includes a report builder with connectors to the most common business intelligence tools. This API makes sense when you need the raw data inside your own product.