# Run your own copy MIT. Copy it, fork it, ship it. Keep the copyright notice. **Our X API keys and Cloudflare secrets are not in this zip.** You bring your own. You pay X (and Cloudflare, if you leave the free tier) for what your copy uses. A fresh zip is rebuilt on every deploy of [spaces.martyearthy.com](https://spaces.martyearthy.com): [`/xspaceslive.zip`](https://spaces.martyearthy.com/xspaceslive.zip). ## What you are getting The site source: schedule, Pages Functions, cron Worker, history, optional push. No recordings of other people's Spaces. No cookies. No `.dev.vars`. Production KV / D1 IDs are replaced with placeholders. If you only want the weekly grid with no live badges, skip the X API. Open `index.html` or deploy static files. Cards stay dark. That path costs nothing at X. ## What it costs if you turn live status on X bills **Spaces reads** (about **$0.005 per Space object** returned) and **user lookups** (about **$0.010**). This code caches in KV so visitors do not each hit X, but a cron that polls many hosts still spends money. Keep `schedule.json` small until you have watched a week of invoices. Cloudflare Pages, KV, and D1 usually fit the free tier for a small fork. Web Push and R2 chat are optional extras. ## Quick path 1. Unzip. `npm install` 2. `cp .dev.vars.example .dev.vars` and paste **your** bearer token 3. `npx wrangler login` (your Cloudflare account, not ours) 4. `bash scripts/fork-setup.sh` creates KV + D1 and writes the IDs into `wrangler.toml` 5. Put the same bearer in Cloudflare secrets (Pages **and** Worker). Commands are printed by the setup script. 6. `npm run deploy` If `xspaceslive` is taken on your account, change `name` in `wrangler.toml`. The deploy script reads that name. Same idea for `worker/wrangler.toml` (`xspaceslive-cron`). ## X bearer [X Developer Portal](https://developer.twitter.com/). App-only **Bearer token**. This project does not use Consumer Key / Secret. Do not commit the token. Do not paste it into the zip, git, or a chat. Cloudflare secrets and a local `.dev.vars` only. ## After it is up - Edit `schedule.json` to **your** hosts. Then deploy Pages and Worker together (`npm run deploy`). They share that file. - Optional push: generate VAPID keys and `wrangler secret put` `VAPID_SUBJECT`, `VAPID_PUBLIC_KEY`, `VAPID_PRIVATE_KEY` on the Worker; public key on Pages too. - Optional R2 chat snapshots: `npx wrangler r2 bucket create YOUR_R2_BUCKET` and put that name in `wrangler.toml`. - Custom domain: set `SITE_URL` and only then consider `CANONICAL_REDIRECT = "1"`. Leave it `"0"` until the domain is yours, or visitors get sent to the original site. ## Local ``` cp .dev.vars.example .dev.vars # add your bearer npm install npm run dev ``` ## License [MIT](LICENSE). Third-party fonts/icons keep their own licenses. X API payloads and host avatars stay with their owners.