Location Launchpad
Location Launchpad — Context
What Is This Project?
An internal web application for managing the full onboarding and opening process for every new SONAN TECH store location. Tracks 60+ auto-generated tasks, budget, reminders, calendar, and daily digest emails.
Repo & Folder
| Item | Value |
|---|---|
| Local folder | E:\Claude_Projects\SONAN DIGITAL\sonan-location-launchpad\ |
| GitHub remote | https://github.com/sonantechai/sonan-location-launchpad |
| Hosting | Cloudflare Pages → auto-builds on push to main |
| Live URL | launchpad.sonantech.com |
| Auth | Cloudflare Zero Trust Access (email OTP) |
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | Plain HTML / CSS / JavaScript (src/ folder) |
| Backend | Cloudflare Functions — serverless edge API (functions/api/) |
| Database | Cloudflare D1 (SQLite at the edge) — binding name DB |
| Config | wrangler.toml — D1 binding, cron triggers, build output dir |
| Build output | src/ (set in wrangler.toml as pages_build_output_dir) |
Key File Structure
sonan-location-launchpad/
src/ ← frontend HTML pages (served by Cloudflare Pages)
index.html ← dashboard
location-detail.html
reminders.html
calendar.html
settings.html
...
functions/api/ ← Cloudflare Functions (edge API routes)
locations/[id].js
reminders.js
reminders/[id].js
calendar.js
cron/daily-digest.js
settings.js
...
db/
migrations/ ← SQL migration files (run manually via wrangler CLI)
seed/
wrangler.toml ← D1 binding, cron schedule, build config
How to Deploy
Code changes:
cd "E:\Claude_Projects\SONAN DIGITAL\sonan-location-launchpad"
git add <files>
git commit -m "..."
git push origin main
Cloudflare Pages detects the push and rebuilds. No build command needed.
Database migrations must be run manually — Cloudflare Pages does not auto-run SQL:
wrangler d1 execute sonan-location-launchpad --remote --file=db/migrations/003_reminders_recurring_email.sql
Always run migrations against --remote (production D1). Test locally with --local.
Cron Trigger
The daily digest email fires via Cloudflare cron. Configured in wrangler.toml:
[[triggers]]
crons = ["0 9 * * *"] # 9am UTC daily
The cron calls functions/api/cron/daily-digest.js which emails reminders due within the configured intervals to the configured address via Resend.
Common Mistakes to Avoid
| Mistake | Prevention |
|---|---|
FUSE git staging corruption — git add from sandbox stages files as deleted | Always use FUSE-safe git plumbing pattern (write to /tmp, hash-object, mktree, commit-tree). Never git add in the sandbox. |
| Forgetting to run DB migration after push | Always document pending migrations in AI Handoff. Run with wrangler d1 execute ... --remote. |
| Testing against production D1 | Use --local for local dev, --remote only for intentional production migrations |
Cloudflare Functions file deleted by FUSE git add | Check git status before committing — "deleted" files in staging area that exist on disk = FUSE corruption. Run git restore --staged . first, then use FUSE-safe method. |