diff --git a/README.md b/README.md index ae9bd3c..de5fa90 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,12 @@ written to `e2e/screenshots/`. `dist/` is a static site. Any static host works; the app needs HTTPS for clipboard, camera and screen capture. -- **Vercel:** import the repository; `vercel.json` sets the build, output directory, security - headers (no framing, HSTS, camera and screen capture limited to this site) and cache rules. -- **Netlify / Cloudflare Pages:** build command `npm run build`, output directory `dist`, and copy - the headers from `vercel.json` into the host's headers file. +- **Cloudflare Workers** (where tick.metricdeck.app runs): `npm run build`, then `npx wrangler deploy`. + `wrangler.jsonc` serves `dist/` with clean paths (`/app` is `app.html`, and `/app.html` redirects + to `/app`); `public/_headers` sets the security headers (no framing, HSTS, camera and screen + capture limited to this site) and cache rules. +- **Netlify / Cloudflare Pages:** build command `npm run build`, output directory `dist`; both read + `public/_headers` as it is. ## Landing page and MetricDeck @@ -72,7 +74,7 @@ screen capture. `/authy-desktop-alternative` (`google-authenticator-on-pc.html`, `authy-desktop-alternative.html`; same header, footer, styles and script as the landing page, each with its own title, description, canonical and structured data: article, breadcrumb and FAQ). A new guide needs its file, an entry - in `PAGES` (`vite.config.ts`), a rewrite and redirect in `vercel.json`, a line in `sitemap.xml` + in `PAGES` (`vite.config.ts`), a line in `sitemap.xml` and `llms.txt`, a link in every page's footer, and its slug in `e2e/run.mjs`. - `llms.txt` summarises Tick and its pages for AI assistants. - Structured data names MetricDeck by the same `@id` metricdeck.app uses @@ -85,9 +87,8 @@ screen capture. `utm_source=tickcodes` and a `utm_content` naming its placement, so visits show up in MetricDeck's analytics. - The MetricDeck mark is inlined in `index.html` (also saved as `public/metricdeck-icon.svg`). -- Production domain: `tick.metricdeck.app`. In Vercel, add the domain under Project → - Settings → Domains, then create a `CNAME` record for `tick` pointing to the target Vercel - shows. If the domain ever changes, update the canonical, Open Graph and sitemap URLs. +- Production domain: `tick.metricdeck.app`, attached to the Worker by `routes` in `wrangler.jsonc` + (Cloudflare creates its DNS record on deploy; metricdeck.app's DNS is on Cloudflare). If the domain ever changes, update the canonical, Open Graph and sitemap URLs. ## Project layout diff --git a/public/_headers b/public/_headers new file mode 100644 index 0000000..533a90d --- /dev/null +++ b/public/_headers @@ -0,0 +1,13 @@ +/* + X-Frame-Options: DENY + Content-Security-Policy: frame-ancestors 'none' + X-Content-Type-Options: nosniff + Referrer-Policy: no-referrer + Permissions-Policy: camera=(self), display-capture=(self), microphone=(), geolocation=() + Strict-Transport-Security: max-age=63072000; includeSubDomains + +/assets/* + Cache-Control: public, max-age=31536000, immutable + +/sw.js + Cache-Control: no-cache diff --git a/public/_redirects b/public/_redirects new file mode 100644 index 0000000..75d5501 --- /dev/null +++ b/public/_redirects @@ -0,0 +1,3 @@ +/app.html /app 301 +/google-authenticator-on-pc.html /google-authenticator-on-pc 301 +/authy-desktop-alternative.html /authy-desktop-alternative 301 diff --git a/vercel.json b/vercel.json deleted file mode 100644 index e9975aa..0000000 --- a/vercel.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "$schema": "https://openapi.vercel.sh/vercel.json", - "framework": "vite", - "buildCommand": "npm run build", - "outputDirectory": "dist", - "headers": [ - { - "source": "/(.*)", - "headers": [ - { - "key": "X-Frame-Options", - "value": "DENY" - }, - { - "key": "Content-Security-Policy", - "value": "frame-ancestors 'none'" - }, - { - "key": "X-Content-Type-Options", - "value": "nosniff" - }, - { - "key": "Referrer-Policy", - "value": "no-referrer" - }, - { - "key": "Permissions-Policy", - "value": "camera=(self), display-capture=(self), microphone=(), geolocation=()" - }, - { - "key": "Strict-Transport-Security", - "value": "max-age=63072000; includeSubDomains" - } - ] - }, - { - "source": "/assets/(.*)", - "headers": [ - { - "key": "Cache-Control", - "value": "public, max-age=31536000, immutable" - } - ] - }, - { - "source": "/sw.js", - "headers": [ - { - "key": "Cache-Control", - "value": "no-cache" - } - ] - } - ], - "rewrites": [ - { - "source": "/app", - "destination": "/app.html" - }, - { - "source": "/google-authenticator-on-pc", - "destination": "/google-authenticator-on-pc.html" - }, - { - "source": "/authy-desktop-alternative", - "destination": "/authy-desktop-alternative.html" - } - ], - "redirects": [ - { - "source": "/app.html", - "destination": "/app", - "permanent": true - }, - { - "source": "/google-authenticator-on-pc.html", - "destination": "/google-authenticator-on-pc", - "permanent": true - }, - { - "source": "/authy-desktop-alternative.html", - "destination": "/authy-desktop-alternative", - "permanent": true - } - ] -} diff --git a/vite.config.ts b/vite.config.ts index c95ceb1..cb1b00c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -31,8 +31,8 @@ function csp(): Plugin { }; } -// Pages served at clean paths (/app → app.html). Vercel rewrites them in production -// (vercel.json); this does the same for the dev and preview servers. +// Pages served at clean paths (/app → app.html). Cloudflare does it in production +// (html_handling in wrangler.jsonc); this does the same for the dev and preview servers. const PAGES = ['app', 'google-authenticator-on-pc', 'authy-desktop-alternative']; function cleanRoutes(): Plugin { diff --git a/wrangler.jsonc b/wrangler.jsonc new file mode 100644 index 0000000..28d2334 --- /dev/null +++ b/wrangler.jsonc @@ -0,0 +1,10 @@ +{ + "$schema": "./node_modules/wrangler/config-schema.json", + // Static site on Cloudflare Workers: no code, just dist/. Clean paths (/app serves app.html, + // /app.html redirects to /app) come from html_handling; headers from public/_headers. + "name": "tick", + "compatibility_date": "2026-10-01", + "assets": { "directory": "./dist", "html_handling": "auto-trailing-slash" }, + "routes": [{ "pattern": "tick.metricdeck.app", "custom_domain": true }], + "workers_dev": false +}