1. What is the Web Sandbox and Why It Exists
When you ask Accelerated Logic AI to "Build a dashboard", static markdown code blocks are not enough. You need an interactive environment to test UI states, verify responsive layouts, and inspect browser errors.
The Web Sandbox runs generated code in a sandboxed browser preview. Sandboxing restricts access to the workspace, but an infinite loop or heavy code can still slow or freeze the tab. Previews may contact external services referenced by the code.
2. The Sandbox UI — 3 Main Panels
Project selector dropdown, device viewports (Desktop, Tablet 768px, Mobile 375px), Console drawer toggle, Open in New Tab, ZIP Download, and Push to GitHub.
Virtual file system tree (index.html, src/App.tsx, src/index.css) paired with an embedded code editor for real-time adjustments.
Live rendering iframe on the right and an expandable Console Drawer at the bottom to inspect console.log output, React key warnings, and missing imports.
3. Web Projects & Local Persistence
Every generated preview is saved as a discrete project in local browser memory:
- Project Names: Auto-generated by timestamp, editable at any time via the top dropdown.
- Instant Switch: Jump between projects seamlessly from the top bar dropdown menu.
- Cloud Sync Integration: When Google Drive backup is enabled, project state files sync automatically to cloud storage.
4. Hot Reloading & Surgical Code Editing
0.5s Debounced Hot Reload: Editing code in the left file panel instantly updates the right iframe preview without requiring a full browser page refresh.
Surgical Chat Diffs: When you request follow-up tweaks in chat (e.g., "Add dark mode toggle to the navbar"), the Finalizer agent performs targeted diff replacements on existing virtual project files.
5. Viewport Testing & Console Debugging
Switch between Desktop, Tablet (768px), and Mobile (375px) device frames to test responsive Tailwind breakpoints (sm:, md:, lg:). Expand the bottom Console Drawer to catch missing module imports or unhandled promises.
6. Preview Limitations & "Open in New Tab"
Because preview frames run inside a restricted sandbox, certain browser APIs (such as modal alert() popups, top-level camera/mic permissions, or cross-origin port requests) are restricted. Click Open in New Tab to pop out the sandbox into a full top-level browser context.
7. Exporting Code & GitHub Integration
Packages all virtual project files into a Vite-ready .zip archive containing package.json and full source directories.
Authenticate with a GitHub Personal Access Token (PAT) to commit and push virtual files directly to public or private repositories.
8. Sandbox Troubleshooting Tips
- White Screen: Verify that
src/App.tsxhas a validexport defaultstatement. - Tailwind Styles Missing: Ensure
src/index.cssincludes standard Tailwind directive imports. - Console Errors: Open the bottom Console Drawer to verify missing dependencies or syntax errors.
9. A Full Build Loop: From One Sentence to a Running App
The shortest reliable path from idea to interactive preview — each step maps to features covered elsewhere in these docs:
- Seed the request: In chat, type "Build an expense-tracker with a table, an add form, monthly totals, and a CSV export button. Preview in canvas." The Finalizer emits the component; the canvas preview renders inline (Part 19).
- Escalate to the sandbox: When the single file gets crowded, click Open in Web Sandbox. Your component lands in
src/App.tsxwith sibling files (src/components/...,src/index.css) the assistant can now edit with surgical diffs. - Drive by chat, edit by hand: Either hand-edit
App.tsxin the left panel (0.5s debounced reload) or tell the assistant "extract the totals row into a TotalsBar component and add a useMemo" — the Finalizer patches the existing files in place. - Test like a user: Toggle the Tablet and Mobile viewport frames; open the Console drawer; click through the add/delete flows. Ask for "a keyboard-accessible delete confirmation" rather than a mouse-only interaction.
- Capture the artifact: When it is presentable, name the project (top dropdown), confirm Drive backup if enabled, and ZIP-download or Push to GitHub. Projects only live in this browser until exported (Section 11).
10. Multi-File Projects — Adding, Renaming, Deleting Files
- Adding a file: create it in the file explorer (or ask the assistant to "split utils into src/utils/format.ts"); the preview picks up new module graphs on the next reload.
- Imports must resolve: virtual files import each other by relative path exactly as in a Vite project — a mismatched extension or case (
./Cardvs./card) shows up as a Console drawer error, not a white screen, most of the time. - Deleting safely: remove the file, then search the remaining tree for its imports — a dangling
importis the most common cause of the blank preview after a cleanup. - Entry contract: keep
index.html→src/main.tsx→src/App.tsx(default export) intact. Restructure freely below that contract; rename above it and the preview breaks. - Styling source of truth: Tailwind directives belong in
src/index.css; inlinestyle={}props work but defeat the design-system point of Tailwind.
11. What Persists, What Doesn't — Storage & Loss Scenarios
Web Sandbox projects are browser-local data. Plan around the failure modes that actually happen:
| Event | Project survives? | Mitigation |
|---|---|---|
| Reload / close tab | Yes (local storage) | Nothing to do |
| Browser cache clear / site data wipe | No | ZIP download or Drive backup before clearing; Part 17 |
| Storage quota exhausted | Oldest regenerable caches evicted first; app retries | Download ZIPs of finished projects; deleting unused projects frees quota |
| Private/incognito window | Gone when window closes | Never build something you care about in a private window without exporting |
| Different browser or machine | No (storage is per profile) | Drive sync for projects (Part 17) or push to GitHub |
12. Sandbox Network Behavior — What the Preview Can and Cannot Reach
- Loading CDN libraries the code references (React builds, icon packs, fonts)
- Fetching public APIs that send CORS headers (most open JSON APIs)
- Rendering images/media from any reachable origin
- Local state via the preview's own isolated storage — separate from the workspace's storage
- APIs without CORS — the preview is a web page, so opaque responses are opaque
- Endpoints holding secrets in the URL — previews are not a vault; inject keys via your own backend
window.parentreach — the sandbox deliberately cannot script the workspace shell (Part 22)alert()and other modal popups (Section 6) — they may be suppressed; use in-page UI