Formosa ESG 2026 — Project Development Record
Development Record

Formosa ESG 2026
Baishatun Mazu Pilgrimage GPS Tracking System — Project Development Record

From Proof of Concept to 10,000-User System: Development Overview

Version 1.0 Coverage Period: 2026/03/23 — Last Updated: 2026/04/07 Formosa ESG Project Team
5
Development Phases
4
Load Test Rounds
106+
Issues Resolved
4
Locales Supported

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.

Event Date
2026/04/12 Departure
Event Duration
~8-9 days (at Mazu's will)
Capacity Target
10,000 concurrent users
Supported Locales
zh-Hant / en / ja / zh-Hans
Frontend Framework
Astro + Cloudflare Pages
Backend Architecture
Workers + D1 + KV

2. Development Phase Overview

PhaseDateCore ObjectivesStatus
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

DatePhaseWork ItemStatus
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.

RoundDateTest FocusVU RangeKey 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:

Solution 1 — KV Buffer
Write check-ins to KV (not D1), key = gps:{ts}:{userId}:{randomId}
Solution 2 — Cron Flush
Batch flush KV → D1 every 5 minutes, INSERT OR IGNORE prevents duplicates
Solution 3 — Data API Cache
Stats first check KV cache (TTL 60s), miss then query D1

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:

ItemFix ItemDescription
GP-1Auto-track persistencelocalStorage Status persists across sessions
GP-2Batch Batch uploadAccumulated offline check-ins uploaded in batch
GP-3Sync endpointFrontend ↔ Worker data sync API
GP-4GPS accuracy filteringauto-skip if accuracy > threshold
GP-5Speed detection≤15 km/h zero-emission / >15 km/h motorized transit
GP-6Distance calculation fixHaversine formula + mileage accumulation
GP-7Timestamp standardizationUTC → ISO 8601 unified format
GP-8Duplicate check-in protectionTime interval + location distance dual check
GP-9Error RecoveryNetwork 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.

Zero-emission (≤15 km/h)
0 kg CO₂e / person·km
Motorized transit (>15 km/h)
0.12013 kg CO₂e / person·km
Accommodation carbon
8.85 kg CO₂e / night
Data source
ecoinvent — regular bus (person·km)

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.

CategoryItemCostDescription
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

IssueTitleRiskStatus
#998 system resilience improvements (error handling, Promise.allSettled, localStorage fallback) L1Deployed
#100RFC — HealthAlert + Service Worker + Offline Fallback L2Deployed
#101_redirects dual domain redirect loop (emergency revert) L3Reverted
#102Dual auth system alignment (KV invite code + Worker secret) L2Deployed
#103Carbon motorized transit coefficient correction (ecoinvent person·km basis) L2Deployed
#105Push supports image + image+text formats L1Deployed
#106Volunteer visibility scope fix L1Deployed
#107/verification/ checklist page L1In Progress
#108/docs/ documentation center + Footer expansion L1In Progress

9. Delivered Documents

Document NameVersionPurposeStatus
Pilgrim User Guidev0.4General user operation guide Live
Admin User Guidev0.5Dashboard operation + push notifications + user management Live
FAQv1.0User self-help troubleshooting Live
Privacy Policyv1.0Data Collection and Privacy Live
Pre-Launch Checklistv1.0Partner / Sponsor reference Done
Project Development Record (this document)v1.0Complete development journey record Done
Volunteer User GuideVolunteer operation guide Planned

10. Development Milestones

03/23 — Project Launch
PoC complete, EXIF GPS reading + D1 write feasibility confirmed
03/24 — MVP Live
Survey + GPS check-in + carbon footprint + achievement card + LINE Bot,Zero to functional in 24 hours
03/25 — Major UX Overhaul
One-question-per-page card workflow, 9-tier level system, LIFF integration, share cards, Dashboard map. Load test R1 completed same day
03/26 — Load Tests Complete
R2-R4 complete, confirmed D1 bottleneck and KV Buffer solution direction
03/29 — KV Buffer Verified
All three solutions deployed and verified: KV Buffer, Cron Flush, Data API Cache
03/31 — GPS Pipeline Fix
GP-1 ~ GP-9, 9 fixes deployed, data quality significantly improved
04/03 — mazu.today Live
Independent domain live, brand recognition improved, all LINE links migrated
04/05 — Full Deployment
RFC #100 + Issues #99 / #102 / #103 / #105 / #106 deployed together. Open issues resolved
04/07 — Pre-Launch Review
Checklist complete, tech docs inventory, cost optimization Plan A deployed.5 days until departure
04/12 — Departure Day
Departure from Baishatun Gongtian Temple. System goes live.

Formosa ESG 2026 — Baishatun Mazu Pilgrimage GPS Tracking System

mazu.today  |  This Document Version 1.0  |  Last Updated 2026/04/07

隱私權聲明問題回報
EN