junv.cc is reserved for k3s home services, not Cloudflare apps. Both dev and prod private hosts now live under heygo.cc, sharing the .heygo.cc cookie domain — no cross-domain auth issues.
Heygo
Heygo is an independent Cloudflare React + Workers scaffold for a future shortlinks app.
This repository lives at /home/ai-bot/code/heygo and is intentionally separate from the old Linux/Django Links repository. The old Links repository under /home/ai-bot/code/links is read-only reference material only and must not be modified by this project.
Local development
npm install
npm run dev
npm run dev:worker
npm run devstarts the Vite React SPA dev server.npm run dev:workerstarts the Cloudflare Worker locally with Wrangler.
Verification
npm run build
npm test
npm run buildtype-checks the TypeScript project and builds the React SPA intodist/clientfor Workers Assets.npm testruns Vitest tests against the Worker API handler.
Deployment
Heygo ships as a single Cloudflare Worker fronted by two custom domains: a public shortlink host and a private shortlink host. There are two environments, each with its own D1 database, KV namespace, Worker, and domains.
| Environment | Public host | Private host | Worker | D1 database |
|---|---|---|---|---|
| dev | dev.heygo.cc |
my.dev.heygo.cc |
heygo-dev |
heygo-shortlinks-dev |
| prod | heygo.cc |
my.heygo.cc |
heygo |
heygo-shortlinks |
The Worker reads PUBLIC_HOST, PRIVATE_HOST, APP_BASE_URL, and
COOKIE_DOMAIN from env vars (set in each wrangler config), so the same code
serves every environment without hardcoded hostnames.
Prerequisites
- A Cloudflare account with the
heygo.cczone added. - A Cloudflare API token with D1, Workers KV, Workers Scripts, and Workers Routes permissions.
- Terraform >= 1.5 installed.
1. Provision infrastructure with Terraform
The terraform/ directory provisions the D1 database, KV namespace, and both
Worker custom domains. See terraform/README.md for full details.
export CLOUDFLARE_API_TOKEN=*** # fill account_id + zone_ids first
npm run infra:init
npm run infra:plan:dev # review, then:
npm run infra:apply:dev
npm run infra:plan:prod # review, then:
npm run infra:apply:prod
2. Copy Terraform outputs into Wrangler configs
After infra:apply:dev, read the created resource IDs:
terraform -chdir=terraform output -var-file=environments/dev.tfvars
Paste the printed d1_database_id into wrangler.dev.jsonc
(d1_databases[].database_id) and kv_namespace_id into
wrangler.dev.jsonc (kv_namespaces[].id). Repeat for prod outputs into
wrangler.prod.jsonc. The placeholder 00000000-... IDs are there until you
fill them in.
3. Apply D1 migrations
npm run migrate:dev
npm run migrate:prod
4. Deploy the Worker
npm run deploy:dev
npm run deploy:prod
Dev environment
The dev environment uses dev.heygo.cc (public) and my.dev.heygo.cc (private),
both under the .heygo.cc cookie domain. Session cookies set by the app UI on
dev.heygo.cc are automatically visible to my.dev.heygo.cc, so private
shortlink auth works out of the box — no extra configuration needed.
Prod works the same way: heygo.cc and my.heygo.cc share .heygo.cc.
Current API skeleton
GET /api/healthreturns JSON health status from the Worker.- Unknown
/api/*routes return JSON404responses.