Formosa ESG 2026
Baishatun Mazu Pilgrimage GPS Tracking System — Project Development Record
From Proof of Concept to 10,000-User System: Development Overview
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 |
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 |
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.
Operating Cost Structure
Below are the actual costs during system development and operation. Infrastructure and push notification costs scale with user growth during the event period.
| Category | Item | Cost | Description |
|---|---|---|---|
| AI Development Tools | Claude Max 20x Subscription | $200 USD/mo | Primary development tool covering coding, architecture design, and documentation |
| Claude Extra Credits | Usage-based | Additional usage during high-intensity development, varies by pace | |
| Claude Prepaid Credits | $250 USD | Pre-purchased credits for real-time operations during the event | |
| Infrastructure | Cloudflare Workers Paid | $5 USD/mo | Removes the 100K/day request limit |
| Cloudflare KV / D1 Usage | ~$40 USD/mo | KV ops account for 84% (dev period); estimated ~$46/mo at 10K users, ~$27/mo after optimization | |
| mazu.today Domain | — | Reverse-proxied via Cloudflare Workers, no additional cost | |
| User Communications | LINE OA Premium Plan | NT$1,200/mo | Upgraded to top-tier plan during event, includes 6,000 push messages |
| LINE Push Overage | NT$0.2/msg | Per-message charge beyond 6,000 messages |
The above are ongoing costs that vary with development phase and event status. Cloudflare cost optimization Plan A (removing redundant KV delete operations) has been completed; further adjustments will be made based on actual event traffic.
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 | In Progress |
| #108 | /docs/ documentation center + Footer expansion | L1 | In Progress |
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 | Planned |