# WA+ Dashboard Publishing Guide

This dashboard is a static site, but it includes influencer performance and cost data. Do not publish it as an open public link.

## Recommended free path: Cloudflare Pages with password

Use this if you want one online link that coworkers can open from anywhere, with a shared username and password.

1. Create a free Cloudflare account.
2. Create a GitHub repository and upload the contents of this `watchalong-dashboard` folder.
3. In Cloudflare, go to `Workers & Pages`.
4. Select `Create application`.
5. Select `Pages`.
6. Connect the GitHub repository.
7. Use these build settings:
   - Framework preset: `None`
   - Build command: `exit 0`
   - Build output directory: `.`
8. Before the first production deploy, add environment variables:
   - `DASHBOARD_USERNAME`: the username coworkers will enter, for example `watchalong`
   - `DASHBOARD_PASSWORD`: the shared password coworkers will enter
9. Deploy the site.
10. Share the `*.pages.dev` link, username, and password only with approved coworkers.

The file `functions/_middleware.js` protects every request with browser basic authentication. If `DASHBOARD_PASSWORD` is missing, the site returns an error instead of exposing the dashboard.

## If your link ends in workers.dev

If the link looks like `https://watchalong-dashboard-1.yourname.workers.dev/`, you deployed it as a Cloudflare Worker, not a Pages site.

That can work too, but the Worker must be deployed with static assets. Otherwise the page may load while files like `data/wa_plus_performance.json` return 404.

This folder now includes:

- `worker.js`: the password gate for Cloudflare Workers.
- `wrangler.jsonc`: tells Cloudflare to upload this folder as static assets.
- `.assetsignore`: keeps local-only files out of the deployed public assets.

To redeploy as a Worker from this folder:

```bash
npx wrangler deploy
```

In the Cloudflare Worker settings, add these variables:

- `DASHBOARD_USERNAME`
- `DASHBOARD_PASSWORD`

After redeploying, open the same `workers.dev` link again. It should ask for the username and password, then load the dashboard data.

If you do not want to use Wrangler, use the Cloudflare Pages flow above instead. Pages is usually easier for this dashboard.

## Stronger free path: Cloudflare Access

If you want better control, use Cloudflare Access instead of a shared password. This lets you approve specific coworker emails or a company domain and avoids one password being forwarded around.

Cloudflare Access is usually the better option for sensitive internal data, but shared password protection is included here because it is the simplest workflow.

## Avoid for this dashboard

- GitHub Pages by itself: it does not provide password protection for the static files.
- Public Netlify Drop by itself: it creates an open public link unless you add paid or external protection.
- Public Vercel by itself: it creates an open public link unless deployment protection is configured.

## Updating the dataset

After editing the Excel workbook, regenerate the JSON data:

```bash
python3 scripts/prepare_data.py "/path/to/WA+ Influencer performance 25-26.xlsx" data/wa_plus_performance.json
```

Then redeploy the same folder or push the updated data file to your hosting repo.

## Privacy note

The dashboard includes the data in `data/wa_plus_performance.json`. Anyone who has the password can open the dashboard and can technically inspect or download the underlying data files, so share access only with people who are allowed to see influencer costs and performance.
