Shabbat Guard is a lightweight, open-source JavaScript library that allows you to automatically disable your website during Shabbat (Friday sunset → Saturday nightfall).
It calculates Shabbat times based on the visitor’s location and custom minhagim (traditions) using the Hebcal API.
Originally published as
shabat-kodesh, the project has been renamed to shabbat-guard for clearer branding and consistency with the domain shabbatguard.com.
- Detects if it is currently Shabbat based on visitor location (Geolocation or IP fallback).
- Retrieves candle-lighting and havdalah times from Hebcal.
- Displays an overlay blocking the site with a “closed for Shabbat” message.
- Supports different minhagim: default (≈40 min), Chabad (≈50 min), Jerusalem 40, or custom minutes.
- New in v1.3: full custom design — colors, title, message, and image via query parameters.
The official landing page: https://shabbatguard.com
On the site, you can generate a ready-to-use <script> tag by selecting:
- Location detection mode (Geolocation / IP / both / none)
- Minhag (Default / Chabad / Jerusalem 40 / Custom minutes)
- Optional custom design: background, text colors, custom title/message, and an image.
This makes integration as easy as copy-paste — no coding required.
Paste this in your <head> or before </body>:
<script src="https://cdn.shabbatguard.com/shabbat-guard.umd.min.js?location=api&minhag=default" defer></script>location:api|prompt-then-api|prompt-only|noneonDeny:api|none(only relevant forprompt-only)minhag:default|chabad|jerusalem40|customhavdalah: minutes (ifminhag=custom)
customDesign=truetitle,message,imagebgColor,textColor,cardBg,accentColor
Example:
<script src="https://cdn.shabbatguard.com/shabbat-guard.umd.min.js?location=api&minhag=custom&havdalah=45&customDesign=true&title=Site%20Closed%20for%20Shabbat&message=We%27ll%20be%20back%20after%20Shabbat&bgColor=%231a1a1a&textColor=%23ffffff&cardBg=%232a2a2a&accentColor=%23d4af37" defer></script>For modern projects:
<script type="module" src="https://cdn.shabbatguard.com/shabbat-guard.esm.min.js"></script>Or import directly:
import { initShabbatGuard } from 'https://cdn.shabbatguard.com/shabbat-guard.esm.min.js';
initShabbatGuard("https://cdn.shabbatguard.com/shabbat-guard.umd.min.js?location=api&minhag=default");- Accurate (Geolocation, fallback to IP):
<script src="https://cdn.shabbatguard.com/shabbat-guard.umd.min.js?location=prompt-then-api&minhag=default" defer></script>- Geolocation only (if denied → no block):
<script src="https://cdn.shabbatguard.com/shabbat-guard.umd.min.js?location=prompt-only&onDeny=none&minhag=default" defer></script>- IP only, Chabad minhag (≈50 min):
<script src="https://cdn.shabbatguard.com/shabbat-guard.umd.min.js?location=api&minhag=chabad" defer></script>- IP only, Custom 45 minutes + custom design: (see example above)
- Issues and PRs are welcome.
- Please note: this project provides a technical tool — not halachic rulings. Site owners should consult their Rabbi for practical guidance.
MIT © 2025
Released as open source to help site owners preserve the sanctity of Shabbat online.