Where distributed computing meets rubber ducks π¦
- β Frontend (Vue.js 3 with WebSocket)
- β Backend (Node.js with Express)
- β Code Execution System (Docker-based)
- β Real-time Updates (WebSocket)
- π‘ Testing Framework (Help wanted!)
- π‘ Documentation System (Work in progress)
- β Node.js (Valkey-glide, iovalkey)
- β Python (Valkey-glide, valkey-py)
- π¨ Java (Compilation support coming soon)
- π¨ Go (Runtime integration planned)
- β Monaco Code Editor
- β Real-time Code Execution
- β Task Manager Demo
- β Leaderboard Demo
- β Code Templates (Python, Node.js, Java)
- π‘ Challenge System (Under construction)
- π‘ Documentation Browser (Needs love)
[Frontend 8080] ββ [Backend 3000] ββ [Valkey Services]
β β β
Vue.js + Monaco Node.js + Express |
WebSocket Client WebSocket Server |
β |
Docker Executors ββββββ
(Python/Node.js)
- Clone & Setup:
git clone https://github.com/avifenesh/valkey-sandbox.git
cd valkey-sandbox
./setup.sh --dev # For development
# or
./setup.sh # For production
- Access:
- Frontend: http://localhost:8080
- Backend: http://localhost:3000
- Valkey Standalone: localhost:6379
- Valkey Cluster: localhost:7000-7005
- Docker-based isolated environments with resource limits
- Multi-language support (Python/Node.js)
- Real-time output streaming
- Security pattern analysis
from valkey_glide import GlideClient
# Connect to Valkey
client = GlideClient(host='valkey-standalone', port=6379)
# Basic operations
await client.set('key', 'value')
result = await client.get('key')
print(f"Retrieved: {result}")
# Example response
{
'output': 'Retrieved: value\n',
'error': None,
'execution_time': 0.001,
'memory_used': 8192
}
import { GlideClient } from '@valkey/valkey-glide';
// Connect to Valkey
const client = await GlideClient.createClient({
host: 'valkey-standalone',
port: 6379
});
// Basic operations
await client.set('key', 'value');
const result = await client.get('key');
console.log('Retrieved:', result);
// Example response
{
output: "Retrieved: value\n",
error: null,
executionTime: 0.001,
memoryUsed: 15925248
}
// Execute code
{
action: 'runCode',
data: {
language: 'python|javascript',
code: string,
mode: 'standalone|cluster'
}
}
// Task management
{
action: 'startTasks',
data: { tasks: Task[] }
}
// Resource limits
{
memory: "128mb",
cpu: "5s",
fileSize: "1mb",
processes: 5
}
// Forbidden patterns
const forbidden = [
"process.env",
'require("child_process")',
'import("child_process")',
"eval",
"Function",
];
- Lazy loading & code splitting
- WebSocket optimizations
- Virtual scrolling
- Service worker caching
- Memory caching
- State management
// Lazy loading with code splitting
const routes = [
{
path: '/playground',
component: () => import('@/views/Playground.vue')
}
];
// WebSocket message batching
const wsManager = {
queuedMessages: [],
retryDelay: 5000,
maxRetries: 5,
sendBatch() {
if (this.queuedMessages.length) {
this.ws.send(JSON.stringify(this.queuedMessages));
this.queuedMessages = [];
}
}
};
// Key visualization components for real-time demos
components/
βββ watch/
β βββ WatchContainer.vue # Main container for watch-in-action demos
β βββ ActionSelect.vue # Demo selection interface
β βββ visualizations/
β β βββ LeaderboardVisualization.vue # Real-time sorted sets demo
β β βββ TaskManagerVisualization.vue # Distributed locks & queues demo
β βββ components/
βββ WatchEditor.vue # Specialized code editor for demos
βββ WatchTerminal.vue # Real-time output terminal
// Base editor components with Monaco integration
components/
βββ base/
β βββ BaseEditor.vue # Monaco editor wrapper
β βββ BaseTerminal.vue # Xterm.js terminal wrapper
βββ Editor.vue # Main editor component with language support
// Core layout and navigation components
components/layout/
βββ Sidebar.vue # Main navigation sidebar
βββ TopTabs.vue # Tab-based navigation
βββ LoadingOverlay.vue # Loading states & transitions
-
Real-time Visualization
// WatchContainer.vue const wsManager = useWebSocket(); const terminalInstance = ref(null); // Handles real-time updates const messageHandler = (event) => { switch (event.action) { case "taskUpdate": handleTaskUpdate(event.payload); break; case "leaderboardUpdate": handleLeaderboardUpdate(event.payload); break; } };
-
Code Editor Integration
// BaseEditor.vue const editorOptions = { fontFamily: "JetBrains Mono", fontSize: 14, minimap: { enabled: false }, automaticLayout: true, scrollBeyondLastLine: false };
-
WebSocket Communication
// Example from WatchVisualization const handleActionSelect = async ({ action, client }) => { wsManager.send({ action: "init", component: action, client: client }); // Handle response in messageHandler };
-
State Management
// Store integration example const state = reactive({ currentClient: savedState.currentClient, executionMode: savedState.executionMode, currentTab: getTabFromHash(), watchState: null });
-
Event Bus Pattern
const eventBus = { on: (event, callback) => { /* ... */ }, emit: (event, data) => { /* ... */ }, off: (event, callback) => { /* ... */ } };
-
Props & Events
<!-- Parent-child communication --> <WatchVisualization :ws="wsInstance" :isConnected="isConnected" @terminal-write="handleTerminalWrite" />
-
Dependency Injection
// Provide at app level provide('wsManager', wsManager); provide('eventBus', eventBus); // Inject in components const wsManager = inject('wsManager'); const eventBus = inject('eventBus');
-
Lazy Loading
const DocComponents = { GeneralConcepts: defineAsyncComponent(() => import('./content/GeneralConcepts.vue') ), CommandsReference: defineAsyncComponent(() => import('./content/CommandsReference.vue') ) };
-
Virtual Scrolling
<virtual-scroller :items="commandList" :item-height="40" v-slot="{ item }" > <command-item :command="item" /> </virtual-scroller>
-
Debounced Updates
const debouncedUpdate = debounce((value) => { store.saveState(value); }, 300);
The setup.sh
script provides additional options:
./setup.sh --dev # Development mode with hot-reloading
./setup.sh # Production mode
./setup.sh --cleanup # Clean up all running processes
./setup.sh --log # Enable logging
./setup.sh --rebuild # Rebuild Docker images
./setup.sh --reinstall # Reinstall dependencies
Features:
- Automatic dependency checking
- Service health monitoring
- Development/Production environment setup
- Clean process management
- Logging configuration
- Frontend Development:
cd frontend
npm install
npm run serve
- Backend Development:
cd backend
npm install
npm run dev
Modify docker-compose.yml
for development:
- Use volume mounts for hot reloading
- Enable debug ports
- Set environment to development
-
Testing Infrastructure
- Jest for backend
- Vue Test Utils for frontend
- Cypress for E2E tests
- GitHub Actions CI/CD
-
Documentation
- OpenAPI/Swagger for REST endpoints
- WebSocket protocol documentation
- Example collection
-
Features
- Valkey cluster management UI
- Challenge system
- Template marketplace
-
Security
- Authentication system?
- Rate limiting
- Sandbox environment isolation
- Code analysis
- No test coverage
- Limited error handling
- Basic monitoring
- Missing CI/CD pipeline
- Use ESLint and Prettier for code formatting
- Follow Vue.js style guide for frontend code
- Write meaningful commit messages
- Document new features and APIs
- Create feature branch from
main
- Implement changes
- Write tests
- Submit PR with description
- Code review
- Merge to
main
POST /execute
- Run codeGET /templates
- Get code templatesWS /appws
- WebSocket connection
- Standalone mode: Direct connection
- Cluster mode: Managed through proxy
// Enable debug mode
const ws = new WebSocket("ws://localhost:8080/appws");
ws.onmessage = (e) => console.log("WS:", JSON.parse(e.data));
# View specific service
docker-compose logs -f backend
# View all services
docker-compose logs -f
# Check container stats
docker stats
# Monitor cluster
watch -n1 'docker-compose exec valkey-cluster valkey-cli -p 7000 cluster info'
- Backend API Spec:
/docs/api.md
- WebSocket Protocol:
/docs/websocket.md
- Valkey Integration:
/docs/valkey.md
- Task Manager:
/examples/task-manager
- Leaderboard:
/examples/leaderboard
- Code Execution:
/examples/code-execution