Skip to content

bryanwhiting/forecastingapi

Repository files navigation

ForecastingAPI.com

ForecastingAPI.com is an open-source forecasting project with two separate parts in one repo:

  • forecastingapi/ → Python forecasting engine API surface (backed by core models)
  • site/ → Astro + Tailwind web app (submit payloads, track jobs, view reports)

Architecture

1) Python forecasting package (forecastingapi/)

Input payload (recommended order):

  • run_name_root
  • start_datetime
  • granularity
  • seasonal_period
  • backtest_windows
  • horizon
  • series_names (list)
  • series_data (single list or list-of-lists)

The engine builds continuous timestamps (no gaps), trains models, and forecasts after the last point.

Current backend: Nixtla StatsForecast (AutoARIMA + AutoETS) with rolling backtesting + SMAPE.

2) Astro website (site/)

  • Landing page (/) for payload submission + run status
  • Forecast pages (/forecasts/[slug]) generated from JSON artifacts
  • Per-series charts + backfill accuracy views

Environment setup

Create local env file from template:

cp .env.example .env.local

Fill values in .env.local (never commit real secrets).


Local usage

Python

python -m venv .venv
source .venv/bin/activate
pip install -e .
python -m forecastingapi.cli --input workflows/example_payload.json --output site/src/data/forecasts/demo.json

Site

cd site
npm install
npm run build

Deploy (GitHub + Cloudflare Pages)

1) Push repo

git push origin main

2) Create Cloudflare Pages project

Project name used here: forecastingapi

3) Set GitHub repo secrets

In bryanwhiting/forecastingapi → Settings → Secrets and variables → Actions:

  • CLOUDFLARE_API_TOKEN
  • CLOUDFLARE_ACCOUNT_ID

4) Set Cloudflare Pages Function secrets

In Cloudflare Pages project (forecastingapi) → Settings → Environment variables / secrets:

  • GITHUB_TOKEN (PAT with repo/workflow permissions)
  • ALLOWED_REPO (e.g. bryanwhiting/forecastingapi)

5) Enable workflows

Workflow used:

  • Forecast Request (build artifacts, commit, and deploy to Cloudflare Pages)

6) Trigger a forecast

Use app UI or run workflow dispatch with payload.


Notes

  • demo_mode_m5 is reserved for demo runs.
  • Backtests require enough history (horizon * windows + train span).
  • For concurrent runs, workflow uses retry + rebase push logic.

About

Open-source time-series forecasting package + Astro reports

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors