<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: brixtonmavu</title>
    <description>The latest articles on Forem by brixtonmavu (@brixtonmavu).</description>
    <link>https://forem.com/brixtonmavu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3727053%2F414be476-06bf-4257-9f89-2164d760ba74.jpeg</url>
      <title>Forem: brixtonmavu</title>
      <link>https://forem.com/brixtonmavu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/brixtonmavu"/>
    <language>en</language>
    <item>
      <title>The Caretaker Sandbox: An Offline-First Visual Playground &amp; Template Engine powered by Gemma 4</title>
      <dc:creator>brixtonmavu</dc:creator>
      <pubDate>Sat, 23 May 2026 07:28:56 +0000</pubDate>
      <link>https://forem.com/brixtonmavu/the-caretaker-sandbox-an-offline-first-visual-playground-template-engine-powered-by-gemma-4-2bgl</link>
      <guid>https://forem.com/brixtonmavu/the-caretaker-sandbox-an-offline-first-visual-playground-template-engine-powered-by-gemma-4-2bgl</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/google-gemma-2026-05-06"&gt;Gemma 4 Challenge: Build with Gemma 4&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Caretaker Sandbox&lt;/strong&gt; is a lightweight, offline-first developer playground and template deck designed for travel, remote work, and instant visual drafting. Rather than acting as a redundant code IDE, it is designed from the ground up to be a pocket instrument—perfect for crafting visual blocks such as transactional templates, responsive layouts, sign-off slips, forms, and custom web cards.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Purpose: Design On-The-Go, Healed by AI
&lt;/h3&gt;

&lt;p&gt;We’ve all had those moments on a flight, train ride, or deep in a cafe with spotty Wi-Fi: you want to spin up a quick, highly stylized mock or format a piece of dynamic HTML/CSS, but spinning up heavy development servers or depending on cloud environments fails. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Caretaker Sandbox&lt;/strong&gt; solves this with a two-track architecture:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fully Isolated Offline Core&lt;/strong&gt;: You can code, inject responsive custom styles, preview in an isolated frame, and toggle boilerplates (like the &lt;em&gt;DHAS Secure Visa&lt;/em&gt; or &lt;em&gt;Invoice details&lt;/em&gt;) completely offline. It features a custom client-side syntax highlighter, interactive panels, and a custom &lt;strong&gt;state difference tracker with full Undo/Redo historical control&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemma 4 Cyber-Caretaker (Online-Ready)&lt;/strong&gt;: The moment your device hits a connection, Gemma 4 is unlocked as a powerful structural assistant. Directly inside your sandbox workspace, it can &lt;strong&gt;instantly generate responsive designs&lt;/strong&gt;, &lt;strong&gt;auto-diagnose and heal runtime syntax bugs&lt;/strong&gt;, or &lt;strong&gt;manage physical workspace files&lt;/strong&gt; in your sandboxed filesystem using smart, semantic commands.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Elegant "Cyber Midnight" Theme Palette
&lt;/h3&gt;

&lt;p&gt;To prevent developer eye strain under dark airplane cabins or dimly lit environments, the entire template editing deck is built with a bespoke, Obsidian-inspired premium cyber styling palette utilizing customized hex tokens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Darkest Obsidian Onyx&lt;/strong&gt; (&lt;code&gt;#060609&lt;/code&gt; / &lt;code&gt;#0c0d12&lt;/code&gt;) for background layers and editing panels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vibrant Lavender &amp;amp; Soft Violet&lt;/strong&gt; (&lt;code&gt;#a78bfa&lt;/code&gt; / &lt;code&gt;#c084fc&lt;/code&gt;) for key action items and active visual splits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vivid Emerald Green&lt;/strong&gt; (&lt;code&gt;#10b981&lt;/code&gt; / &lt;code&gt;#34d399&lt;/code&gt;) for success indicators and string variables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Neon Pink &amp;amp; Cyber Pink&lt;/strong&gt; (&lt;code&gt;#f472b6&lt;/code&gt;) for syntax keywords and UI triggers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warm Tangerine&lt;/strong&gt; (&lt;code&gt;#fb923c&lt;/code&gt; / &lt;code&gt;#f59e0b&lt;/code&gt;) for warnings and structural properties.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Experience the live visual sandbox environment here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🚀 &lt;strong&gt;Live App Preview&lt;/strong&gt;: &lt;a href="https://zbd-hub.onrender.com/" rel="noopener noreferrer"&gt;https://zbd-hub.onrender.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;GitLab Repository&lt;/strong&gt;: &lt;a href="https://gitlab.com/brixmavu/zbd_hub" rel="noopener noreferrer"&gt;Gemma 4 Caretaker Sandbox Repository&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The application contains zero redundant heavy full-stack frameworks—no React, Express, or Vite compilation scripts blocking start times. It is built as a pure Node.js HTTP command plane and client-side web sandbox.&lt;/p&gt;

&lt;p&gt;The backend maps routes with nanosecond response times using standard built-in streams. It routes instructions straight to Google's official &lt;code&gt;@google/genai&lt;/code&gt; client.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inside the Schema-Restricted Core
&lt;/h3&gt;

&lt;p&gt;Here is how we configure the prompt instructions in &lt;code&gt;gemini.ts&lt;/code&gt; to guarantee flawless, instant visual renderings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;GoogleGenAI&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@google/genai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ai&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;GoogleGenAI&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GEMINI_API_KEY&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;generateTemplate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;systemInstruction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`You are a professional Cyberpunk Web Template Generator. Return ONLY a JSON object with keys "html", "css", "js".
Do not wrap your response in markdown fences and do not add any explanation or text outside the JSON. It must be a valid, parsed, complete JSON.`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generateContent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gemini-3.5-flash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Generate a web template for: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;systemInstruction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;responseMimeType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;responseSchema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;OBJECT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;STRING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HTML layout structure containing components.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="na"&gt;css&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;STRING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Beautiful stylesheets and styling properties.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
          &lt;span class="na"&gt;js&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;STRING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Raw JavaScript code adding interactivity and state handlers.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How I Used Gemma 4
&lt;/h2&gt;

&lt;p&gt;Integrating highly capable models like Gemma 4 to operate as a physical supervisor over real visual design files involves heavy semantic reasoning. We tailored our setup to accommodate two paths: online high-end compilation and offline edge-computing execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Models Chosen
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gemma 4 31B Dense (Primary Studio Caretaker)&lt;/strong&gt;: When connected to the network, we leverage the robust, state-of-the-art Gemma 4 31B Dense reasoning path (proxied via the client). The 31B Dense architecture is the ideal fit here. Designing websites requires a holistic understanding of how nested layers relate to class indicators and dynamic DOM query selectors. The 31B model exhibits high spatial layout intelligence, drafting complex multi-column grids and writing pristine vanilla functions that execute without logical collision.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemma 4 E4B / E2B (Edge &amp;amp; Offline Travel Companions)&lt;/strong&gt;: Because of our travel-first commitment, offline developers can run the lightweight Gemma 4 E4B or E2B models directly on their device via local runners (e.g., &lt;code&gt;llama.cpp&lt;/code&gt; or Ollama inside native Terminal environments), using this frontend sandbox as an interactive local editor container.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Caretaker's Three Modules
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Visual Synthesizer (&lt;code&gt;generateTemplate&lt;/code&gt;)&lt;/strong&gt;: Translates standard English prompts into an immediately renderable &lt;code&gt;{ html, css, js }&lt;/code&gt; JSON block. Enforcing strict JSON outputs prevents annoying markdown code block symbols from clogging up compilation streams.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Code Caretaker Auto-Healer (&lt;code&gt;fixTemplate&lt;/code&gt;)&lt;/strong&gt;: When your layout looks off or throws a standard error, you type a short guideline. Gemma 4 reads the current code bundle alongside your visual critique, refactoring only the buggy segments while reserving the rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Virtual CRUD Filesystem Manager (&lt;code&gt;caretakerCrud&lt;/code&gt;)&lt;/strong&gt;: Translates loose instructions like &lt;em&gt;"Save this design in a folder named templates under visa.html"&lt;/em&gt; into safe CRUD JSON directives. The Node server executes these securely into process-isolated generated spaces.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Summary Comparison
&lt;/h2&gt;

&lt;p&gt;Whether you are looking for an elegant drafting tool or diving deep into the code underpinnings, here is a quick overview of why the Sandbox stands as a high-craft utility:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;For the Technical Developer&lt;/th&gt;
&lt;th&gt;For the Creative / Non-Technical Reader&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Pure Event-Driven Node Server:&lt;/strong&gt; Leverages the native HTTP server module, eliminating the overhead of bloated modern frameworks.&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Instant Visual Feedback:&lt;/strong&gt; Write layout descriptions in plain English and see them turn into operational web blocks immediately.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Strict JSON Schemas:&lt;/strong&gt; Validated type constraints prevent API text hallucination and ensure 100% stable parser mapping.&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Zero Setup Work:&lt;/strong&gt; Start creating in your browser right away without dealing with installations or configurations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Immutable Undo/Redo Differ:&lt;/strong&gt; An array-bound history ring captures state snapshots, ensuring zero-loss rollbacks.&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Aesthetic Dark Mode:&lt;/strong&gt; A gorgeous Obsidian Onyx color canvas that is gentle on your eyes during long late-night sessions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Regex-Driven Client-Side Tokenizer:&lt;/strong&gt; A lightweight syntax highlighter parses and colors tags, classes, properties, and strings instantly in memory.&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Pre-Loaded Templates:&lt;/strong&gt; Access preset templates (like interactive invoices or form pads) right out of the box.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;em&gt;Submission authored by Brixton Mavu (&lt;a href="https://dev.to/brixtonmavu"&gt;@brixtonmavu&lt;/a&gt; on DEV.to)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
