📊 Turn Google Sheets into a lightweight database with dynamic routing in Astro.js! No backend, no traditional CMS—just a simple, free, and serverless way to manage content.
✅ Google Sheets as a Database – Store and manage content easily.
✅ Dynamic Routing – Auto-generates pages based on your sheet data.
✅ Free & Serverless – No hosting costs, no backend needed.
✅ SEO-Friendly – Static, fast, and optimized for search engines.
1️⃣ Edit sitemap.xml – Update it for your site structure.
2️⃣ Modify fetchbooks.js – Adjust data fetching as needed.
3️⃣ Customize the frontend – Tweak styles, layout, and content to match your vision.
1️⃣ Add Deployment Hook – If you are using Cloudflare Pages, its called Deployment Hook.
2️⃣ **Add following code to Appscript
const CLOUDFLARE_WEBHOOK_URL = "YOUR_WEBHOOK_URL";
function onEdit(e) {
const cache = CacheService.getScriptCache();
cache.put("lastEdit", new Date().toString(), 600); // Store last edit time for 10 mins
// Clear previous triggers (prevents stacking)
ScriptApp.getProjectTriggers().forEach(trigger => {
if (trigger.getHandlerFunction() === "triggerCloudflareBuild") {
ScriptApp.deleteTrigger(trigger);
}
});
// Set a delayed trigger to run 10 mins after the last edit
ScriptApp.newTrigger("triggerCloudflareBuild")
.timeBased()
.after(10 * 60 * 1000) // 10 minutes
.create();
}
function triggerCloudflareBuild() {
const cache = CacheService.getScriptCache();
const lastEditTime = new Date(cache.get("lastEdit"));
const now = new Date();
// Ensure no further edits have happened in the last 10 mins
if (now - lastEditTime >= 10 * 60 * 1000) {
UrlFetchApp.fetch(CLOUDFLARE_WEBHOOK_URL, { method: "POST" });
}
}3️⃣ Add Trigger – Function to run: onEdit Event source: From spreadsheet Event type: On edit
📖 Full tutorial 👉 Read here
Got ideas? Bugs? PRs welcome! Let’s make this cooler together. 🎉
💙 Star this repo if you love free stuff! ⭐✨