A set of small, dependency-free JS modules for static sites — DOM helpers, fetch wrappers, cookies, URL utilities, and a WhatsApp QR login flow. Import what you need directly from jsDelivr; no npm install, no bundler.
Import modules straight from jsDelivr's CDN with a <script type="module"> tag. No npm install, no bundler config, no build step.
getJSON, postJSON, putJSON, deleteJSON — thin wrappers over the native Fetch API with a consistent {status, data} callback.
onClick, setInner, getValue, serializeForm, show/hide — skip repetitive document.getElementById calls. Pair with debounce.js for search-as-you-type.
auth.js and stp.js give you a ready-made WhatsAuth QR-code and OTP login flow, including Google Sign-In.
cookie.js, storage.js, url.js, and validate.js cover session cookies, localStorage/sessionStorage (with optional expiry), query strings, and input sanitization.
Every module is a separate CDN file — .../lib@version/cookie.js — so your page only loads the code it actually needs.
toast.js shows dismissable notifications with zero external libraries — an alternative to pulling in SweetAlert2 just for a message.
geo.js loads GeoJSON from a URL or a local file, validates it, and always hands back a FeatureCollection — plus getBBox, getCenter, and getPropertyKeys for feeding a map or a table.
Get started with CrootJS in just a few lines of code. Import from CDN and start building dynamic websites immediately.
// Import CrootJS functions from CDN
import { setInner, onClick, getValue }
from "https://cdn.jsdelivr.net/gh/crootjs/lib@0.0.13/element.min.js";
import { postJSON } from "https://cdn.jsdelivr.net/gh/crootjs/lib@0.0.13/api.min.js";
// Configure backend URL
const urlBackend = "https://api.example.com";
// Handle login button click
onClick("loginBtn", () => {
// Get form values
const email = getValue("email");
const password = getValue("password");
// Send login request
postJSON(`${urlBackend}/login`, { email, password }, (response) => {
// Handle response
if (response.status === 200) {
setInner("demo", "Login successful!");
}
});
});
CrootJS requires separating HTML, CSS, and JS into their own files, with JS loaded as type="module" — no inline <script>/<style>, no onclick. Drop CLAUDE.md into your project root so Claude Code (or any agent that reads a root instructions file) follows this automatically.
curl -o CLAUDE.md https://raw.githubusercontent.com/crootjs/lib/main/CLAUDE.md
Explore real-world examples and templates built with CrootJS. Fork the examples repo on GitHub to get started quickly.
A cookie-based login form example — checks the session cookie and redirects automatically.
View Demo →A minimal example showing how to set element text content with CrootJS's setInner helper.
View Demo →Render dynamic text onto an HTML canvas with auto-fitting font size, powered by CrootJS.
View Demo →Alerts, delete confirmation, a validated form inside a dialog, and a loading state around getJSON.
View Demo →Load GeoJSON from a URL or a local file with geo.js, draw it on a Leaflet map, and list its properties in a table.
View Demo →See how CrootJS compares to other frameworks in terms of performance and bundle size.
View Benchmark →Browse the per-module docs, check the source, or fork one of the working examples.