This is a submission for the Gemma 4 Challenge: Build with Gemma 4
What I Built
The Caretaker Sandbox is a lightweight, offline-first design deck and template suite built for web developers. It isn't a complex, heavy IDE designed to replace your terminal; instead, it is a dedicated utility tool in your pocket for constructing, compiling, and detailing lightweight client templates—such as transaction emails, document signature grids, custom interactive PDFs, forms, or responsive visual component headers.
The project is designed with travel and absolute portability in mind. When you are on an airplane, in a train, or off-grid without stable internet, it acts as a fully self-contained sandboxed editor using a pure-vanilla browser-run state engine complete with auto-indenting, syntax highlighting, undo/redo, local templates, and a live secure iframe preview. Once you hit active reception with connection, it unlocks Gemma 4's full intelligence, serving as an automated structural caretaker that spawns design elements from simple prompts, auto-heals code from runtime errors, and executes isolated file system actions on the host machine.
The entire environment runs without the baggage of heavy modern frameworks—zero dependency on React, Express, or Vite. It is powered entirely by a tiny pure-Node.js HTTP command-and-control plane and vanilla front-end scripts, making it perfectly tailored to run on local machines, headless servers, or even Termux on your mobile phone!
Demo
Experience the live Caretaker Sandbox:
- Live: https://zbd-hub.onrender.com/
-
Primary Creator: Brixton Mavu (DEV credential:
brixtonmavuorbrixmavu)
Code
You can access the full template setup configuration scripts and modular repository engine here:
- Source Code: Gitlab
The entire platform is built with a singular bootstrap configuration script (init.sh or update.sh) that installs dependencies (@google/genai and dotenv), configures pure-ESM settings, and outputs the lightweight sandboxing components on command.
How I Used Gemma 4
Integrating Gemma 4 model intelligence as an automated backend advisor for a secure code-regulation workspace requires prompt precision, layout understanding, and structured schema-aligned outputs.
Which model did I use and why?
For the Caretaker Sandbox, we targeted a multi-tier architectural approach that leverages the distinct power of Gemma 4 models:
-
Gemma 4 31B Dense (The Main Studio Caretaker): We selected the robust 31B Dense model as our primary structural design adviser. When you are connected to the network, the Sandbox uses the modern, lightning-fast
gemini-3.5-flashclient to drive the Caretaker's layout reasoning. The 31B Dense configuration represents the absolute peak of Gemma 4's developer intelligence, allowing it to translate loose layout descriptions into pristine, well-structured HTML elements, CSS variables, and clean vanilla Javascript widgets without breaking syntax rules. - Gemma 4 E4B / E2B (Edge & Offline Travel Companions): Because this toolbox is designed for offline travel (airplanes, train rides, and remote spots), developers can run lighter lightweight models like Gemma 4 E4B or E2B in their local command-line terminals (e.g. via llama.cpp or Ollama in Termux) while using our sandbox as their visual playground. The E4B model is incredibly fast and highly optimized for on-device code generation, striking a near-perfect balance between small device memory and developer accuracy.
The Gemma Caretaker Core
In our workspace, Gemma's interactions are structured across three core developer disciplines:
-
The Cyberpunk Web Template Generator (
generateTemplate) Gemma receives a natural-language description from the user (e.g., "Create a sleek cyberpunk transaction email layout with dark styling") and returns structured parameters inside a schema-validated prompt constraints. It outputs exact parameters:{ html, css, js }. No markdown code fences block the parser—giving you instant layout rendering. -
The Code Caretaker Auto-Healer (
fixTemplate) If an interaction fails or throwing styling discrepancies occur during runtime inspection, you can supply your instructions alongside the active code and error logs. Gemma acts as a refactoring expert, repairing structural layout anomalies and formatting issues while maintaining existing state. -
The FS Caretaker Virtual CRUD Controller (
caretakerCrud) The model translates language definitions into precise operations (e.g., folder synthesis, local file generation, system deletes). These logical commands are safely executed through our pure-Node server into a protected/generatedenvironment directory.
Key Visual and Functional Highlights
- Travel-Ready Architecture: Runs smoothly off-grid. Code edits, stylesheet rendering, manual file creations, history navigation, and pre-bundled templates work 100% offline.
- Pure-Node Zero-Overhead Server: Stripped of Express/Vite overheads, it uses a lightweight http-level file server with zero-lock static asset caches that map files instantly into memory.
- Custom Client-Side Engine: Features a full advanced state manager that diffs nested structures into structured states, providing effortless undo/redo control. Combined with on-the-fly custom syntax coloring and layout splits, it is custom designed to maximize high-contrast accessibility.
Authored by **Brixton Mavu* (brixtonmavu / brixmavu on DEV.to)*
Top comments (0)