PROMPT UTAMA (SIAP COPY–PASTE)
Build an Advanced Google Sheets CRUD Web App with Real-Time Data
Act as a senior full-stack developer specialized in Google Apps Script, SPA architecture, and Google Sheets as a database.
🎯 Objective
Build a production-ready Advanced CRUD Web App using:
Google Apps Script (Web App)
Google Sheets as a real-time database
Single Page Application (SPA)
🧩 Backend (Google Apps Script – code.gs)
Use Google Sheets as the primary database.
Implement a REST-like API Router using
doGet(e)anddoPost(e):
list→ Read all data
get→ Read single record by ID
create→ Insert new record
update→ Update record
delete→ Delete recordAutomatically initialize sheet structure if the sheet does not exist:
Columns:
id,timestamp,nama,kategori,deskripsi,statusGenerate UUID for primary key.
Return all responses in JSON format only.
Enable CORS-safe access for frontend fetch.
Optimize performance with:
Batch read/write
Minimal Spreadsheet calls
🧩 Frontend (index.html)
Build a Single Page Application (SPA) using:
Vanilla JavaScript (no framework)
Fetch API
UI Requirements:
Responsive layout
Modern dashboard UI (Tailwind CSS or Bootstrap 5)
Hero section
Data table with:
Live reload (real-time refresh after CRUD)
Search & filter
Pagination
Modal form for:
Add data
Edit data
Delete confirmation
Form validation (client-side).
Show loading state & error handling.
🔄 Real-Time Behavior
After Create / Update / Delete:
Automatically refresh UI without page reload
Use:
google.script.runOR
fetch()to Web App endpoint
🧱 Architecture
Clean separation:
SheetService→ Data access layer
ApiController→ Routing layer
UIController→ Frontend logicCommented code and scalable structure.
📦 Deliverables
code.gs(complete backend)
index.html(complete frontend SPA)Step-by-step deployment instructions:
Deploy as Web App
Access permission setup
Clear explanation of:
Data flow
CRUD lifecycle
Real-time update mechanism
⭐ Bonus (Optional but Preferred)
Toast notifications
Soft delete support
Role-based access (admin/viewer)
Export data to CSV
Output the final solution with clean, professional, and well-structured code.
Tidak ada komentar:
Posting Komentar