How to Configure Windows Sandbox Local SurrealDB Multi-Model Database via XML in Windows 11

Modern application architectures frequently require multi-model databases that seamlessly unify document, graph, relational, and vector data models into a single engine. SurrealDB offers powerful SurrealQL querying and real-time live query subscriptions. Testing SurrealDB schemas, graph traversal queries, and authentication permissions directly on a developer workstation can leave lingering database files and port 8000 conflicts. In Windows 11, Windows Sandbox provides a pristine, isolated testing platform. By authoring custom Windows Sandbox XML (.wsb) configuration files, you can deploy a standalone SurrealDB engine in seconds.

Architecture of the Disposable SurrealDB Sandbox

Windows Sandbox provides a disposable, hypervisor-isolated guest environment that resets completely upon termination. To provision an automated SurrealDB instance, the architecture requires:

  • A mapped host folder: A directory containing the standalone surreal.exe binary and custom startup configuration flags.
  • A WSB configuration file: An XML blueprint that mounts the mapped directory and initiates the database agent automatically via LogonCommand.

Authoring the Windows Sandbox WSB Blueprint

Create a working directory on your host machine, such as C:\SandboxSurrealDB. Download the Windows binary of SurrealDB into this directory, then create RunSurrealDB.wsb with the following XML code:

<Configuration>
  <VGpu>Default</VGpu>
  <Networking>Default</Networking>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\SandboxSurrealDB</HostFolder>
      <SandboxFolder>C:\SurrealFiles</SandboxFolder>
      <ReadOnly>false</ReadOnly>
    </MappedFolder>
  </MappedFolders>
  <LogonCommand>
    <Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\SurrealFiles\Start-SurrealDB.ps1</Command>
  </LogonCommand>
</Configuration>

Authoring SurrealDB Startup Script

Inside the mapped host folder (C:\SandboxSurrealDB), create the PowerShell initialization script named Start-SurrealDB.ps1:

Write-Host "=============================================" -ForegroundColor Cyan
Write-Host " Starting SurrealDB Multi-Model Engine...    " -ForegroundColor Green
Write-Host " HTTP / WebSocket Endpoint: http://127.0.0.1:8000 " -ForegroundColor Yellow
Write-Host " Root User: root / root                      " -ForegroundColor Yellow
Write-Host "=============================================" -ForegroundColor Cyan

# Launch SurrealDB in memory storage mode with root credentials
& "C:\SurrealFiles\surreal.exe" start --user root --pass root --bind 0.0.0.0:8000 memory

Running and Validating Queries in the Sandbox

Double-click RunSurrealDB.wsb on your Windows 11 host. Windows Sandbox boots up, mounts the mapped folder, and immediately launches SurrealDB inside an interactive PowerShell window.

The database listener binds to port 8000, supporting HTTP REST queries, WebSocket live queries, and Surrealist web studio connections. Open Microsoft Edge inside the sandbox and connect to Surrealist or dispatch curl requests against http://127.0.0.1:8000/sql.

You can execute graph relation queries, test document validations, and verify record-level permissions in total isolation. When testing concludes, closing the sandbox window instantly eliminates all memory datastores, query caches, and server processes, leaving your host workstation completely clean.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.