Formosa ESG 2026
Baishatun Mazu Pilgrimage GPS Tracking System — Project Development Record
From Proof of Concept to 10,000-User System: 26-Day Journey Including Live Operations
1. Project Overview
"Formosa ESG 2026 Baishatun Mazu Pilgrimage GPS Tracking System" is a pilgrimage tracking service combining GPS positioning, carbon footprint estimation, and community interaction. Pilgrims log in via LINE, use their phones for real-time check-ins, accumulate mileage, view level progress, and can share personalized achievement cards. The system also provides an admin dashboard with live maps, push notifications, user management, and other backend functions.
The technical architecture uses Astro (frontend SSG) + Cloudflare Pages + Workers + D1 (SQLite) + KV (caching and buffering), combined with LINE LIFF SDK for login and sharing integration. The system is designed to handle 10,000 concurrent users.
2. Development Phase Overview
| Phase | Date | Core Objectives | Status |
|---|---|---|---|
| Phase 0 | 03/23 | PoC: EXIF GPS reading, D1 write feasibility | Done |
| Phase 0.5 | 03/24 | MVP:16-question survey + GPS check-in + carbon footprint + achievement card + LINE webhook | Done |
| Phase 1 | 03/25 | UX overhaul: One-question-per-page cards + 9-tier levels + LIFF + share cards + Dashboard | Done |
| Phase 1.5 | 03/25–26 | Security hardening + Dashboard + LIFF Published + Workers Paid upgrade | Done |
| Phase 2 | 03/25–26 | 4 load test rounds + D1 bottleneck analysis + KV Buffer architecture design | Done |
| Phase 3 | 03/27–04/05 | Pre-launch: KV Buffer implementation + GPS Pipeline Fix + permission system + push notifications + docs | Deployed |
| Phase 4 | 04/01–07 | Feature refinement: achievement card rules + survey optimization + Issue fixes + cost optimization | Deployed |
| Phase 5 | 04/08–11 | 5 rounds of Pre-Launch Audit + segmented push + Issue #155 auto-synced dashboard | Completed |
| Live Ops | 04/12– | Post-launch operations: hotfixes #168/#171/#172 + governance v4.8→v4.12 + post-event branch isolation | In Progress |
3. Daily Work Log
| Date | Phase | Work Item | Status |
|---|---|---|---|
| 03/23 Day 1 |
Phase 0 | EXIF GPS coordinate reading PoC (browser-side EXIF.js) | Done |
| Phase 0 | Cloudflare D1 database creation + Workers API endpoints | Done | |
| Phase 0 | Project page framework (Astro SSG + Cloudflare Pages) | Done | |
| 03/24 Day 2 |
Phase 0.5 | 16-question ESG survey (one-question-per-page card workflow) | Done |
| Phase 0.5 | GPS check-in feature + carbon footprint calculation engine | Done | |
| Phase 0.5 | Achievement card system (check-in point visualization) | Done | |
| Phase 0.5 | LINE Bot webhook integration (Messaging API) | Done | |
| Phase 0.5 | Cloudflare Workers CORS fix + deployment verification | Done | |
| 03/25 Day 3 |
Phase 1 | UX overhaul: one-question-per-page + linear progress bar + swipe animations | Done |
| Phase 1 | 9-tier pilgrim level system (cultivation → ascension), dual conditions: km + check-in count | Done | |
| Phase 1 | 9 AI-generated mascot images (replace emoji level icons) | Done | |
| Phase 1 | LINE LIFF SDK integration (Login channel + init) | Done | |
| Phase 1 | Share card (vertical layout + map + QR code + mascot + stats) | Done | |
| Phase 2 | Load test R1: HTTP layer C-10K ~ C-100K all PASS | Done | |
| 03/26 Day 4 |
Phase 1.5 | Dashboard: heatmap + clustering markers + front/tail + 3 mode switching | Done |
| Phase 1.5 | Security hardening: AuthGate + Admin Token API verification | Done | |
| Phase 2 | Load test R2: 800 VU sweet spot confirmed (99.99% success) | Done | |
| Phase 2 | Load test R3: D1 write bottleneck verification (SQLite single-writer lock) | Done | |
| Phase 2 | Load test R4: real-world scenario simulation (CF-800 PASS / RW-500 Data API bottleneck) | Done | |
| 03/27–28 Day 5–6 |
Phase 3 | Carbon footprint daily reporting frontend + dynamic OG Image generation | Done |
| Phase 3 | Mascot image 4x resolution upgrade + Dashboard AuthGate fix | Done | |
| Phase 3 | 7 UX fixes (photo thumbnails / FB sharing / GPS persistence, etc.) | Done | |
| Phase 3 | Feature inventory: 23-item Done list compiled | Done | |
| 03/29 Day 7 |
Phase 3 | Privacy consent mechanism (P0) + pause/Done status | Done |
| Phase 3 | Carbon footprint simplified to 2-tier structure (zero-emission vs motorized transit) | Done | |
| Phase 3 | QR Code replaced with NET-ZERO logo + FB OG Image fix | Done | |
| Phase 3 | User guides converted to web pages (pilgrim version + admin version) | Done | |
| Phase 3 | LINE Bot guidance link integration | Done | |
| Phase 3 | Event photo archival feature + FB share fbclid fix | Done | |
| 03/30 Day 8 |
Phase 3 | Event photo archival button UX improvement (clear save button) | Done |
| Phase 3 | Personalized FB OG Image implementation | Done | |
| Phase 3 | Test mode banner + photo saving bug fix | Done | |
| 03/31 Day 9 |
Phase 3 | Comprehensive GPS data pipeline fixes GP-1 ~ GP-9 (commit 8f08e5d) | Deployed |
| Phase 3 | KV Buffer architecture implementation: Checkin → KV → Cron batch INSERT D1 | Deployed | |
| Phase 3 | Accommodation carbon coefficient update: 12.5 → 8.85 kgCO₂e/night | Done | |
| 04/01–02 Day 10–11 |
Phase 4 | Survey optimization Q16 → Q10 (reduced 6 questions + renumbered) | Deployed |
| Phase 3 | Three-tier permission system launched: Owner / Manager / Volunteer | Deployed | |
| Phase 3 | Dashboard access logging (fire-and-forget KV logging) | Done | |
| Phase 4 | Achievement card threshold: check-in ≥3 times + completed survey + phone number | Done | |
| 04/03–04 Day 12–13 |
Phase 3 | mazu.today Custom Domain launched (Worker routing + DNS) | Deployed |
| Ops | RFC #100: HealthAlert + Service Worker + Offline Fallback verification | Deployed | |
| Ops | Issue #99:8 resilience improvements (Promise.allSettled, localStorage fallback, etc.) | Deployed | |
| Ops | Issue #102: Dual auth system alignment (KV invite code + Worker secret unified) | Deployed | |
| Phase 3 | LIFF Channel → Published (available to all users) | Deployed | |
| 04/05 Day 14 |
Ops | Issue #103: Carbon motorized transit coefficient correction 0.47515 → 0.12013 kg CO₂e/person·km | Deployed |
| Ops | Issue #105:Push supports image + image+text formats(commit 35945cd) | Deployed | |
| Ops | Issue #106:Volunteer visibility fix (hide only push + user list) | Deployed | |
| Ops | Worker full deployment confirmed (Version 342af8b0) | Deployed | |
| Phase 4 | Cloudflare cost analysis: $44.63/month, KV ops account for 84% | Done | |
| 04/06–07 Day 15–16 |
Phase 4 | KV cost optimization Plan A: Remove TICKER_KV.delete() (commit a4b6fd2) | Deployed |
| Phase 4 | Pre-Launch Checklist generated (7 categories, 34 items) | Done | |
| Phase 4 | Complete tech docs inventory + public deployment plan (/docs/ + /verification/) | Done | |
| Phase 4 | mazu.today Redirect Rules reconnaissance completed (Cloudflare Dashboard solution confirmed) | Done | |
| 04/08–09 Day 17–18 |
Phase 4 | Issue #141: Segmented push notifications + LIFF OA guidance + Secrets audit | Deployed |
| Phase 4 | Issue #120: Push image upload (R2 storage) + Wiki Phase 3–4A | Deployed | |
| Ops | Dashboard migrated to GitHub Issue #155 + sync-dashboard Action auto-sync | Done | |
| 04/10 Day 19 |
Ops | Pre-Launch Audit R3: Data quality + defensive resilience (computeFilteredKm + VALID_SOURCES fix, Worker deploy 174bace0) | Deployed |
| Ops | Issue #162: Today's Good Footprint API verification passed | Done | |
| Ops | CI/CD audit + Governance Framework Phase 1–2.5 completed (Dashboard + API + KV seed) | Deployed | |
| 04/11 Day 20 |
Ops | Pre-Launch Audit R4: User journey + edge personas + operational resilience (P0=0, P1=4 all fixed, Worker deploy 876dddbd) | Deployed |
| Ops | Issue #163: GPS drift + straight-line trajectory fix (speed outlier filter + accuracy filtering) | Deployed | |
| Ops | Issue #161: Share footprint link fix (race condition — lineUserId captured as null before LIFF async) | Deployed | |
| Ops | Pre-Launch Audit R5: Full codebase health check + fixes (P0×2 + P1×6 all fixed, commit 9fa6c9d) | Done | |
| Ops | All 5 rounds of Pre-Launch Audit completed ✅ — core check-in path solid, offline mechanism intact, no dead routes | Done | |
| 04/12 Day 21 — Departure |
Ops | 🎉 Baishatun Gongtian Temple departure, system officially live (Worker version 8148bac5) | Deployed |
| Ops | Departure-day wipe: D1 test data cleared (users 143→0, gps 1140→0, surveys 20→0) + KV gps: buffer 9,255 keys bulk-deleted | Done | |
| Ops | Feedback governance Phase A: formosa-feedback skill Step 6.5 exit gate + session-handoff v4.4 reconciliation + 7 legacy triaging entries PATCH-fixed | Deployed | |
| Ops | Phase B batch-update.yml live: file-based trigger flow (Chat research → Cowork proposal → Code impl → Cowork verify), commit 57024b2 | Deployed | |
| 04/13 Day 22 |
Ops | Issue #168 GPS phantom mileage fix (commit 9160a69) — /track/sync geofence + WHERE source != 'remote' filter; spawned guardrail #13 (new endpoint protection inheritance), session-handoff upgraded to v4.8 | Deployed |
| 04/14 Day 23 |
Ops | Issue #170 pushHours phantom deployment incident: cross-repo truth verification failure; spawned guardrail #14 + Code tri-state declaration spec, session-handoff upgraded to v4.9 | Done |
| Ops | Issue #171 personal footprint carbon field fix (commit 93fb621) — wrong carbon_kg binding; deployed, awaiting LIFF real-device verification | Deployed | |
| Ops | Governance framework Code-First audit landed: session-handoff v4.9 consolidates Code/Cowork tri-state declaration + deferred-trigger behavior verification | Done | |
| 04/15 Day 24 |
Ops | Issue #172 web/LINE dual-rank desync fix (commit a389dd6) — root cause: cross-browser localStorage isolation + Stats API fallback trap (Math.max(len, 1) returns 1 for empty array); spawned #174 AuthGate bypass + #175 auto-close.yml injection | Deployed |
| Ops | Three direct feedback reports triaged: #177 GPS not logged south of Changhua / #178 LIFF persistence affecting LINE groups+calls / #179 camera entry missing + album missing — all post-event labeled; established live-ops principles: silent fix over user-facing warnings, deploy only if backend-only and zero user-visible side-effects | Scheduled | |
| 04/16 Day 25 |
Ops | Cowork sweep + Code Formosa post-event batch fix: Batch 1 (#175 auto-close.yml injection) merged to main (0aeb496); Batch 2+3 (#177/#178/#173/#174/#179) isolated on fix/formosa-post-event branch for post-event merge+deploy | Isolated |
| Ops | Impact Fence (live-ops code barrier) established: 🟢 Safe Zone (CI/CD) → main directly / 🔴 Live Zone (frontend + Worker) → fix/formosa-post-event isolation | Done | |
| 04/17 Day 26 |
Ops | CI race condition systemic fix (commit 70173b2): seo-index.yml + ai-ready-opt.yml gained concurrency group + 3-retry pull --rebase loop, rooting out workflow_run chain-triggered self-race | Deployed |
| Ops | Cowork governance v4.12 landed: dashboard carrier renamed (Apple Notes → Issue #155 single source of truth); added Phase version history v4.7→v4.12 + guardrails #12–#14 lineage | Done |
4. Load Test Results Summary
Conducted 4 rounds of load testing using Grafana k6 (2026/03/25–26) to verify system performance under high concurrency. Test environment: MacBook Air local + Cloudflare Workers production.
| Round | Date | Test Focus | VU Range | Key Results |
|---|---|---|---|---|
| R1 | 03/25 | HTTP Layer Limits | 10K–100K | S-BURST / S-WAVE / S-EXTREME all PASS; 5,000 VU 91% success rate |
| R2 | 03/25 | Capacity Sweet Spot | 200–1,200 | 800 VU = 99.99% success rate (sweet spot); 1,200+ starts declining; recovery test 54% |
| R3 | 03/26 | D1 Write Bottleneck | 500 | DI-500 confirms D1 SQLite single-writer lock; real-time success rate 42%; latency +51% |
| R4 | 03/26 | Real-World Scenario Simulation | 500–800 | CF-800 (direct D1 write) 100% PASS; RW-500 (mixed load) 60% FAIL = Data API bottleneck |
Root Cause & Solutions
R3-R4 tests confirmed the root cause is D1 SQLite's single-writer lock, causing serialization bottlenecks at high concurrency. Solution adopts KV Buffer architecture:
All three solutions deployed and verified as of 2026/03/29.
5. GPS Data Pipeline Fixes
On 2026/03/31, performed comprehensive GPS data pipeline fixes (commit 8f08e5d), covering 9 improvements:
| Item | Fix Item | Description |
|---|---|---|
| GP-1 | Auto-track persistence | localStorage Status persists across sessions |
| GP-2 | Batch Batch upload | Accumulated offline check-ins uploaded in batch |
| GP-3 | Sync endpoint | Frontend ↔ Worker data sync API |
| GP-4 | GPS accuracy filtering | auto-skip if accuracy > threshold |
| GP-5 | Speed detection | ≤15 km/h zero-emission / >15 km/h motorized transit |
| GP-6 | Distance calculation fix | Haversine formula + mileage accumulation |
| GP-7 | Timestamp standardization | UTC → ISO 8601 unified format |
| GP-8 | Duplicate check-in protection | Time interval + location distance dual check |
| GP-9 | Error Recovery | Network interruption auto-retry + error reporting |
6. Carbon Footprint Model
Carbon footprint uses GPS speed auto-detection to classify pilgrimage movement into zero-emission (walking/cycling) and motorized transit. Motorized transit carbon coefficient is academically corrected using ecoinvent "market for transport, regular bus" dataset.
Carbon data includes "estimate" notation and disclaimers, provided for user reference but not as official carbon accounting. Carbon coefficient was corrected and deployed in Issue #103 (old value 0.47515 kg CO₂e/km was vehicle-km basis, semantically incorrect).
7. Infrastructure & Operations
mazu.today Independent Domain
2026/04/03–04 mazu.today Custom Domain launched, reverse-proxied via Cloudflare Workers to paulkuo.tw/projects/formosa-esg-2026/. Covers DNS setup, Worker routing, i18n path mapping, webhook URL migration, etc. All LINE push links now use mazu.today.
Permission System
Three-tier role permissions: Owner (full admin rights), Manager (push + user management), Volunteer (view-only Dashboard maps & stats, no push or user list). Via KV invite code mechanism distributes invite codes, unified with Worker secret unified verification.
Cloudflare Cost Analysis
Other Infrastructure
Workers Paid plan upgraded ($5/month), removed 100K/day request limit. LIFF Channel published to Published Status. LINE OA upgraded to Medium tier (3,000 messages/month). Dashboard push supports text, template, and image formats.
8. Key Issue Tracking
| Issue | Title | Risk | Status |
|---|---|---|---|
| #99 | 8 system resilience improvements (error handling, Promise.allSettled, localStorage fallback) | L1 | Deployed |
| #100 | RFC — HealthAlert + Service Worker + Offline Fallback | L2 | Deployed |
| #101 | _redirects dual domain redirect loop (emergency revert) | L3 | Reverted |
| #102 | Dual auth system alignment (KV invite code + Worker secret) | L2 | Deployed |
| #103 | Carbon motorized transit coefficient correction (ecoinvent person·km basis) | L2 | Deployed |
| #105 | Push supports image + image+text formats | L1 | Deployed |
| #106 | Volunteer visibility scope fix | L1 | Deployed |
| #107 | /verification/ checklist page | L1 | Deployed |
| #108 | /docs/ documentation center + Footer expansion | L1 | Deployed |
| #120 | Push image upload (R2 storage) | L1 | Deployed |
| #141 | Segmented push + LIFF OA guidance | L2 | Deployed |
| #161 | Share footprint link race condition fix | L2 | Deployed |
| #162 | Today's Good Footprint API verification | L1 | Done |
| #163 | GPS drift + straight-line trajectory fix | L2 | Deployed |
| #168 | GPS phantom mileage (stationary users accumulating fake km) — geofence + source filter | L2 | Deployed |
| #170 | pushHours phantom deployment incident — cross-repo truth verification (spawned guardrail #14) | L2 | Done |
| #171 | Personal footprint carbon_kg field mis-binding fix | L1 | Deployed |
| #172 | Web/LINE dual-rank desync (localStorage isolation + fallback trap) | L2 | Deployed |
| #173 | Dashboard Mazu location marker missing | L1 | post-event branch |
| #174 | AuthGate bypass suspected | L2 | post-event branch |
| #175 | auto-close.yml Expression injection — gh api replaces shell heredoc | L1 | Deployed |
| #177 | GPS not logged south of Changhua (Vivo OriginOS power-saving hypothesis) | L1 | post-event branch |
| #178 | LIFF persistence affects LINE groups+calls | L1 | post-event branch |
| #179 | Photo upload: camera entry missing + album missing | L1 | post-event branch |
9. Delivered Documents
| Document Name | Version | Purpose | Status |
|---|---|---|---|
| Pilgrim User Guide | v0.4 | General user operation guide | Live |
| Admin User Guide | v0.5 | Dashboard operation + push notifications + user management | Live |
| FAQ | v1.0 | User self-help troubleshooting | Live |
| Privacy Policy | v1.0 | Data Collection and Privacy | Live |
| Pre-Launch Checklist | v1.0 | Partner / Sponsor reference | Done |
| Project Development Record (this document) | v1.0 | Complete development journey record | Done |
| Volunteer User Guide | — | Volunteer operation guide | Deployed |
10. Development Milestones
fix/formosa-post-event branch for post-event merge. Live-ops bar: backend-only + zero user-visible side-effect.