Hosting, domains and analytics
Domains
Section titled “Domains”| Domain | Role | Points at |
|---|---|---|
filocan.com |
primary, the site | Cloudflare Pages (apps/www) |
www.filocan.com |
redirect to apex | Cloudflare redirect rule |
filocans.com |
misspelling, redirect to apex, logged first | Cloudflare Worker (below) |
docs.filocan.com |
documentation | Cloudflare Pages (apps/docs) |
app.filocan.com |
web build of the app | Cloudflare Pages (apps/app web export) |
api.filocan.com |
Supabase custom domain (optional, paid add-on) | Supabase |
Both .com domains sit on Cloudflare: move the nameservers there from the registrar (free plan is fine). Cloudflare gives us DNS, TLS, redirects, the Worker, and privacy-friendly analytics in one place.
Deploying the site and docs
Section titled “Deploying the site and docs”Cloudflare Pages, one project per app, connected to the GitHub repo.
| Project | Root directory | Build command | Output |
|---|---|---|---|
filocan-www |
/ |
npm ci && npm run build:www |
apps/www/dist |
filocan-docs |
/ |
npm ci && npm run build:docs |
apps/docs/dist |
filocan-app |
/ |
npm ci && npm run build -w packages/shared && npm run export:web -w apps/app |
apps/app/dist |
Set Node to 22 (NODE_VERSION=22 in the project’s environment variables). For filocan-app, also set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY to the production project; without them the deployed web app runs in demo mode, which is actually useful for a preview branch.
Each Pages project gets a custom domain from the table above. Pages handles TLS.
Vercel works identically if you prefer it (vercel.json is not committed; the defaults detect Astro), but keeping the site next to the redirect Worker and the analytics on one dashboard is why Cloudflare is the recommendation here.
filocans.com: redirect with a log
Section titled “filocans.com: redirect with a log”A plain 301 would lose the information you want: how many people typed the plural, and from where. So filocans.com runs a tiny Worker that records the hit, then redirects. Nothing personal is stored: no IP address, no cookies. Country, path, referrer, user agent family and a timestamp are enough to understand the traffic.
workers/redirect/src/index.ts in this repo:
export interface Env { HITS: AnalyticsEngineDataset }
export default { async fetch(req: Request, env: Env): Promise<Response> { const url = new URL(req.url); const cf = (req as Request & { cf?: IncomingRequestCfProperties }).cf; // Workers Analytics Engine: free, unsampled at this volume, queryable with SQL. env.HITS.writeDataPoint({ blobs: [ url.hostname, // filocans.com or www.filocans.com url.pathname + url.search, // what they asked for req.headers.get('referer') ?? '', // where they came from cf?.country ?? '', // ISO country cf?.city ?? '', deviceFamily(req.headers.get('user-agent') ?? ''), ], doubles: [1], indexes: [cf?.country ?? 'XX'], }); const target = new URL(url.pathname + url.search, 'https://filocan.com'); target.searchParams.set('from', 'filocans'); // shows up in site analytics too return Response.redirect(target.toString(), 301); },};
function deviceFamily(ua: string): string { if (/iPhone|iPad/.test(ua)) return 'ios'; if (/Android/.test(ua)) return 'android'; if (/bot|crawl|spider/i.test(ua)) return 'bot'; return 'desktop';}workers/redirect/wrangler.toml:
name = "filocans-redirect"main = "src/index.ts"compatibility_date = "2026-09-01"routes = [ { pattern = "filocans.com/*", zone_name = "filocans.com" }, { pattern = "www.filocans.com/*", zone_name = "filocans.com" },]
[[analytics_engine_datasets]]binding = "HITS"dataset = "filocans_redirects"Deploy with npx wrangler deploy from workers/redirect. In the Cloudflare dashboard for filocans.com, add proxied DNS records @ and www pointing at any placeholder (192.0.2.1, AAAA 100::); the Worker route intercepts before origin.
Reading the redirect log
Section titled “Reading the redirect log”Analytics Engine is queried with SQL through the API or the dashboard (Workers > Analytics Engine). Hits per country in the last 30 days:
SELECT index1 AS country, SUM(_sample_interval * double1) AS hitsFROM filocans_redirectsWHERE timestamp > NOW() - INTERVAL '30' DAYGROUP BY country ORDER BY hits DESCMost common paths people typed (useful for spotting old links):
SELECT blob2 AS path, SUM(_sample_interval) AS hitsFROM filocans_redirectsWHERE timestamp > NOW() - INTERVAL '30' DAYGROUP BY path ORDER BY hits DESC LIMIT 20Referrers, device families and cities are blob3, blob6 and blob5. Data is retained for three months on the free plan; export monthly if you want longer history.
Site analytics (filocan.com and docs)
Section titled “Site analytics (filocan.com and docs)”Cloudflare Web Analytics: free, no cookies, no consent banner needed, and it reports country, referrer, device type, browser, page views, visits, and Core Web Vitals. Enable it in the dashboard (Analytics > Web Analytics > Add a site), copy the beacon token, and set it as PUBLIC_CF_BEACON in the Pages project’s environment. The layout in apps/www/src/layouts/Base.astro injects the beacon only when that variable is present, so local builds stay clean.
Because the redirect Worker appends ?from=filocans, filtering by that query string in Web Analytics shows how much of the site’s traffic came in through the misspelling, matched against the Worker’s own log.
If you want more than Cloudflare’s dashboards (funnels, retention, event tracking on the waitlist button), the two privacy-respecting options that fit the product’s stance are Plausible (hosted in the EU, one script tag) and PostHog (self-hostable, heavier). Google Analytics is deliberately not used: it would contradict the privacy page.
Auditing
Section titled “Auditing”Three places to look when something seems off:
- Cloudflare > Security > Events for both zones: blocked requests, bot scores, countries. Turn on Bot Fight Mode on the free plan.
- Cloudflare > Analytics > Traffic: raw request counts per zone including bots, which Web Analytics excludes.
- Supabase > Logs: Auth logs show every OTP request by phone hash and country; the Postgres logs show RPC calls. Set a log drain to your preferred store before launch so logs outlive Supabase’s 7 day retention.
For the waitlist form on the site (POST /api/waitlist), a Pages Function should store the number in Supabase, send one SMS, and delete the number after sending, as the privacy page promises. That function is not written yet; until it is, the form posts to a route that does not exist and should be hidden or pointed at a Tally form.
Costs at launch
Section titled “Costs at launch”| Item | Monthly |
|---|---|
| Cloudflare (DNS, Pages, Worker, Analytics Engine, Web Analytics) | A$0 |
| Supabase Pro (needed for custom SMS provider and log retention) | ~A$40 |
| SMS via Twilio or MessageBird | ~A$0.08 per code (turn on WhatsApp OTP in Supabase Auth, a fraction of that in most countries, before any launch push) |
| Apple Developer Program | A$149 per year |
| Google Play | US$25 once |
| Domains | ~A$40 per year for the pair |