1. Berikan fitur, saat berjalan dibrowser, "install app"

  2. Siapkan file production mau saya upload digithub

  3. Time zone supabase

    alter database postgres set timezone to 'Asia/Jakarta';
    
  4. Keep Alive✨

KEEP ALIVE


1. SQL Setup (Database & Permission)

-- pastikan tabel ada
create table if not exists public.keepalive (
  id bigint generated by default as identity primary key,
  ping_at timestamptz default now() not null,
  project_name text,
  status text default 'ok'
);

-- kasih akses ke role service_role
grant usage on schema public to service_role;
grant all on table public.keepalive to service_role;
grant all on sequence keepalive_id_seq to service_role;

-- aktifkan Row Level Security (RLS)
alter table public.keepalive enable row level security;

-- policy untuk insert (dengan check true = semua row boleh diinsert)
create policy "allow_insert_keepalive"
on public.keepalive
for insert
with check (true);

📝 Catatan:


2. Apps Script (Insert Data)

klik di sini

function insertKeepalive() {
  var url = "<https://jqpgvnbnbvlxaywvzabc.supabase.co/rest/v1/keepalive>";

  // ⚠️ service_role key ini full akses → jangan taruh di client publik
  var apiKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpxcGd2bmJuYnZseGF5d3Z6YWJjIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1NzgzNzc4MSwiZXhwIjoyMDczNDEzNzgxfQ.itaj5jCdQha682pSg2km02Kgx5UoLzSie6OmANMv_K8";

  var payload = {
    project_name: "izinpulang",  // kolom text
    status: "ok"                 // opsional, default 'ok'
  };

  var options = {
    method: "post",
    headers: {
      "apikey": apiKey,
      "Authorization": "Bearer " + apiKey,
      "Content-Type": "application/json",
      "Prefer": "return=representation" // balikin row yang baru diinsert
    },
    payload: JSON.stringify(payload),
    muteHttpExceptions: true
  };

  var response = UrlFetchApp.fetch(url, options);

  Logger.log("Status: " + response.getResponseCode());
  Logger.log("Body: " + response.getContentText());
}


✅ Jadi flow-nya:

  1. SQL: setup tabel + permission + policy.
  2. Apps Script: UrlFetchApp.fetch dengan POST → insert row baru ke keepalive.
  3. Hasil bisa dicek di Supabase table editor atau via query SELECT * FROM keepalive.