Local Development
This guide covers advanced local development topics. For basic setup, see the Quick Start.
Development Tips
- TypeScript Execution: Use
pnpx tsxinstead ofnpx ts-nodeto run TypeScript files - Browser DevTools: Check Application → Storage to verify storage partitioning
- Hot Reload: Changes in
swarm-ui/src/will automatically reload in the browser - Debugging: Use browser DevTools on both the parent page and the iframe
- Library changes: If you change library code, rebuild it with
cd lib && pnpm build, or usecd lib && pnpm build:watchfor automatic rebuilds
Client-Side Stamp Signing
Stamps bought via the local Bee API are owned by the queen node. Use the queen’s private key for client-side signing:
import { Stamper } from '@ethersphere/bee-js'
const queenKey = '566058308ad5fa3888173c741a1fb902c9f1f19559b11fc2738dfc53637ce4e9'const stamper = Stamper.fromBlank(queenKey, batchId, depth)const envelope = stamper.stamp(chunk)Known Dev Keys
These are the pre-funded keys available in the local FDP Play Bee cluster:
| Node | Private Key | Address |
|---|---|---|
| Queen | 566058308ad5fa3888173c741a1fb902c9f1f19559b11fc2738dfc53637ce4e9 | 0x26234a2ad3ba8b398a762f279b792cfacd536a3f |
| Worker 1 | 195cf6324303f6941ad119d0a1d2e862d810078e1370b8d205552a543ff40aab | - |
Testing with Real Domains (SSH Tunnel)
To test storage partitioning behavior with real TLS certificates (as in production), you can use SSH tunnels to a VPS with nginx.
Architecture
Your VPS (nginx + HTTPS) Your Local Machine┌─────────────────────────┐ ┌─────────────────────┐│ demo.yourdomain.com │◄──────────│ SSH -R tunnels ││ → 127.0.0.1:18080 │ │ 18080 → demo ││ id.yourdomain.com │ │ 5174 → identity ││ → 127.0.0.1:5174 │ │ (Vite dev server) │└─────────────────────────┘ └─────────────────────┘VPS Setup (one-time)
- Add nginx server blocks pointing to
127.0.0.1:18080(demo) and127.0.0.1:5174(identity) - Get SSL certificates with certbot
- Add DNS A records for both subdomains
Local Usage
# Terminal 1: Start demo serverpnpm dev:demo
# Terminal 2: Start SvelteKit dev server with allowed hostsVITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=id.yourdomain.com pnpm dev:swarm-ui
# Terminal 3: Open SSH tunnelssh -R 18080:localhost:3000 -R 5174:localhost:5174 user@your-vpsThe VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS environment variable is required when accessing the Vite dev server through a foreign hostname. Without it, Vite will reject requests from the tunneled domain.
Access the Demo
https://demo.yourdomain.com/?idDomain=https://id.yourdomain.comThe ?idDomain= parameter tells the demo which identity service to use. This allows testing cross-origin storage partitioning with real browser security policies while still having hot reload for the identity UI.