← Back to the EMIS Portal

Cloud Sync Setup Guide

Without this step, each computer or phone keeps its own private copy of the school's data. Follow these steps once so every branch shares the same students, marks, fees, and attendance records.

1. Create the cloud backend

  1. Open script.google.com and start a New project.
  2. Delete the placeholder code, then paste in the full contents of Hasset_Cloud_Backend.js (included in this website's files).
  3. Save the project.

2. Deploy it as a web app

  1. Click Deploy → New deployment.
  2. Choose type Web app.
  3. Set Execute as: Me and Who has access: Anyone.
  4. Click Deploy and copy the Web app URL — it must end with /exec.

3. Connect the main office computer

In the EMIS portal: log in as Admin → Overview, paste the /exec URL into the cloud/database URL field, set Auth style to No auth header, turn Auto-sync on, then Save & connect → Upload now.

4. Connect every other branch computer or phone

Paste the same /exec URL and save — the shared database downloads automatically. Auto-sync then keeps every device aligned roughly every 45 seconds.

5. Optional — automatic connection for every phone

So staff never have to paste the URL themselves, edit cloud-config.json on the server (same folder as index.html):

{
  "url": "https://script.google.com/macros/s/XXXX/exec",
  "authMode": "none",
  "autoSync": true,
  "publicUrl": "https://hassetacademy.com.et/"
}

Every phone that simply opens the school website will then read this file and connect automatically.

If the browser blocks the connection ("Failed to fetch")

Some hosts block direct calls to Google. Use the included PHP proxy instead:

  1. Make sure cloud-proxy.php is uploaded next to index.html (your host must support PHP).
  2. Edit cloud-config.json to point at the proxy instead of Google directly:
{
  "url": "https://hassetacademy.com.et/cloud-proxy.php",
  "upstream": "https://script.google.com/macros/s/YOUR_ID/exec",
  "authMode": "none",
  "autoSync": true,
  "publicUrl": "https://hassetacademy.com.et/"
}

Then in EMIS Overview, set the Cloud URL to https://hassetacademy.com.et/cloud-proxy.php with Auth = No auth header, and click Upload now on the main computer.

Rules to remember