# Website Change Tracker (/docs/experiments/website-change-tracker)



Register URLs for on-demand and **Cron**-scheduled snapshots. Rendered text is stored in **R2**, content hashes and diff summaries in **D1**. View change history per tracked URL.

## Features [#features]

* POST /track - register a URL
* DELETE /track?url= - unregister
* GET /history?url= - snapshot diff history
* Scheduled handler every 30 minutes for tracked URLs

## API Reference [#api-reference]

### POST /track [#post-track]

Register a URL for scheduled tracking.

```json
{ "url": "https://example.com" }
```

### DELETE /track?url= [#delete-trackurl]

Unregister a tracked URL.

### GET /history?url= [#get-historyurl]

Return snapshot history with content hashes and diff summaries.

#### Error Codes [#error-codes]

* `400` - `INVALID_URL`, `INVALID_BODY`
* `404` - `NOT_TRACKED`

## Use Cases [#use-cases]

* Monitor marketing or legal pages for unexpected content changes
* Learn R2 + D1 + Cron + Browser Rendering together
* Prototype change-detection alerts before production hardening

## Limitations [#limitations]

* Requires D1, R2, Browser Rendering, and Cron bindings
* Diff summary is line-based heuristic, not semantic
* 30-minute cron interval; not real-time

## Deployment [#deployment]

<Steps>
  <Step>
    ### Click the deploy button [#click-the-deploy-button]

    [![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/shrinathsnayak/cloudflare-experiments/tree/main/apps/experiments/website-change-tracker)
  </Step>

  <Step>
    ### Configure bindings [#configure-bindings]

    D1 `DB`, R2 `SNAPSHOTS`, Browser `BROWSER`, cron `*/30 * * * *`. Run D1 migrations before deploy.
  </Step>

  <Step>
    ### Test your deployment [#test-your-deployment]

    See the experiment README for curl examples.
  </Step>
</Steps>

## Local Development [#local-development]

```bash
cd apps/experiments/website-change-tracker
npm install
npm run dev
```

## Configuration [#configuration]

D1 `DB`, R2 `SNAPSHOTS`, Browser `BROWSER`, cron `*/30 * * * *`. Run D1 migrations before deploy.

## Cloudflare Features Used [#cloudflare-features-used]

* **[Browser Rendering](https://developers.cloudflare.com/browser-rendering/)**
* **[R2](https://developers.cloudflare.com/r2/)**
* **[D1](https://developers.cloudflare.com/d1/)**
* **[Cron Triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/)**
