PocketBase—a single-file, open-source backend written in Go—provides embedded SQLite storage, realtime subscriptions, file storage, and authentication out of the box. Testing PocketBase collections, API rule validations, and OAuth2 identity integrations directly on a workstation can cause port 8090 conflicts and clutter user directories with test SQLite databases. 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 PocketBase backend and administrative web UI in seconds.
Architecture of the Disposable PocketBase Sandbox
Windows Sandbox provides a disposable, hypervisor-isolated guest environment that resets completely upon termination. To provision an automated PocketBase instance, the architecture requires:
- A mapped host folder: A directory containing the single
pocketbase.exebinary and schema import JSON files. - A WSB configuration file: An XML blueprint that mounts the mapped directory and initiates the server automatically via
LogonCommand.
Authoring the Windows Sandbox WSB Blueprint
Create a working directory on your host machine, such as C:\SandboxPocketBase. Download the Windows binary of PocketBase into this directory, then create RunPocketBase.wsb with the following XML code:
<Configuration>
<VGpu>Default</VGpu>
<Networking>Default</Networking>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\SandboxPocketBase</HostFolder>
<SandboxFolder>C:\PocketBaseFiles</SandboxFolder>
<ReadOnly>false</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>powershell.exe -ExecutionPolicy Bypass -NoExit -File C:\PocketBaseFiles\Start-PocketBase.ps1</Command>
</LogonCommand>
</Configuration>
Authoring PocketBase Startup Script
Inside the mapped host folder (C:\SandboxPocketBase), create the PowerShell initialization script named Start-PocketBase.ps1:
Write-Host "=============================================" -ForegroundColor Cyan
Write-Host " Starting PocketBase Portable Backend... " -ForegroundColor Green
Write-Host " Admin UI: http://127.0.0.1:8090/_/ " -ForegroundColor Yellow
Write-Host " REST API: http://127.0.0.1:8090/api/ " -ForegroundColor Yellow
Write-Host "=============================================" -ForegroundColor Cyan
# Set working directory to sandbox mapped folder
Set-Location "C:\PocketBaseFiles"
# Launch PocketBase server
& "C:\PocketBaseFiles\pocketbase.exe" serve --http="0.0.0.0:8090" --dir="C:\PocketBaseFiles\pb_data"
Running and Validating APIs in the Sandbox
Double-click RunPocketBase.wsb on your Windows 11 host. Windows Sandbox boots up, mounts the mapped folder, and immediately launches PocketBase inside an interactive PowerShell window.
The backend begins listening on port 8090. Open Microsoft Edge inside the sandbox and navigate to http://127.0.0.1:8090/_/ to create an initial superuser account and view the visual schema builder.
You can create collections, test record access rules, upload sample media files, and verify REST API responses in complete isolation. When testing concludes, closing the sandbox window instantly eliminates all SQLite databases, media files, and server processes, leaving your host workstation completely clean.