
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
@playcademy/sandbox
Advanced tools
Local development server for isolated Playcademy game development
The sandbox provides a complete, isolated development environment for building games on the Playcademy platform. It runs entirely locally with a PostgreSQL database (PGLite) that can be configured for either persistent storage or in-memory operation, and serves all Playcademy APIs without requiring external services or authentication.
The sandbox is designed to solve the key challenge of game development: providing a local environment that accurately mirrors the production Playcademy platform while remaining completely isolated and easy to set up.
The sandbox is built on a lightweight stack optimized for development speed:
packages/sandbox/src/
├── cli.ts # Command-line interface
├── server.ts # HTTP server setup
├── constants.ts # Configuration and defaults
├── types.ts # TypeScript definitions
├── database/ # Database setup and seeding
│ ├── index.ts # Database initialization
│ ├── path-manager.ts # Database file management
│ └── seed.ts # Demo data and game seeding
├── lib/ # Core functionality
│ └── auth.ts # Authentication middleware
├── routes/ # API route handlers
└── utils/ # Utility functions
└── port.ts # Port availability checking
# Install globally for use anywhere
bun install -g @playcademy/sandbox
# Start sandbox in any project
playcademy-sandbox
# Install in your project
bun add -D @playcademy/sandbox
# Use via package.json script
{
"scripts": {
"sandbox": "playcademy-sandbox"
}
}
# Basic usage
playcademy-sandbox
# Custom port
playcademy-sandbox --port 3000
# With project information (enables game-specific seeding)
playcademy-sandbox --project-name "My Game" --project-slug "my-game"
# Verbose logging
playcademy-sandbox --verbose
Option | Description | Default |
---|---|---|
--port, -p | Server port | 4321 |
--verbose, -v | Enable verbose logging | true |
--project-name | Display name for your game | - |
--project-slug | URL-safe slug for your game | - |
Once running, the sandbox provides several key endpoints:
/health
- Server health check and status information/api
- API manifest and available endpointsAll production Playcademy APIs are available locally:
/api/users
- User management and profiles/api/games
- Game sessions, state, and uploads/api/inventory
- User inventory management/api/items
- Item definitions and operations/api/shop
- In-game shop functionality/api/shop-listings
- Marketplace listings/api/currencies
- Virtual currency systems/api/levels
- User progression and XP/api/maps
- Game world data and elements/api/dev
- Developer tools and utilities# Server status
http://localhost:4321/health
# API manifest
http://localhost:4321/api
# User profile
http://localhost:4321/api/users/me
# Game sessions
http://localhost:4321/api/games/{gameId}/sessions
The sandbox automatically:
The sandbox supports two database storage modes:
node_modules
directory# Default persistent storage location:
# ./node_modules/@playcademy/vite-plugin/node_modules/.playcademy/sandbox.db
# In-memory mode can be enabled via:
# - memoryOnly: true in programmatic usage
# - setupDatabase(':memory:') for custom path
The sandbox includes simplified authentication for development:
// Your game code
const API_BASE = 'http://localhost:4321/api'
// Fetch user inventory
const inventory = await fetch(`${API_BASE}/inventory`)
const items = await inventory.json()
// Add item to user inventory
await fetch(`${API_BASE}/inventory/add`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ itemId: 'sword-001', quantity: 1 }),
})
import { PlaycademySDK } from '@playcademy/sdk'
// Initialize SDK with sandbox
const sdk = new PlaycademySDK({
apiUrl: 'http://localhost:4321/api',
})
// Use SDK methods normally
const user = await sdk.users.getProfile()
const inventory = await sdk.inventory.getItems()
# Build for distribution
bun run build
# Development with auto-reload
bun run dev
# Start without building
bun run start
The build process includes:
.d.ts
files for type safetyWhen developing a specific game, provide project information for enhanced development experience:
playcademy-sandbox \
--project-name "Equation Arena" \
--project-slug "equation-arena"
This enables:
import { startServer } from '@playcademy/sandbox'
const server = await startServer({
port: 4321,
verbose: true,
memoryOnly: true,
seed: true,
project: {
slug: 'my-game',
displayName: 'My Game',
version: '1.0.0',
},
})
// Use in-memory database (no persistence)
const server = await startServer({
port: 4321,
memoryOnly: true, // Use in-memory database
})
Port Already in Use
# Sandbox automatically finds available port
playcademy-sandbox --port 4321
# Will use 4322, 4323, etc. if 4321 is taken
API Not Responding
/health
endpoint first# Enable verbose logging
playcademy-sandbox --verbose
# Check server health
curl http://localhost:4321/health
The sandbox is a crucial development tool for the Playcademy ecosystem. When contributing:
For general contribution guidelines, see the monorepo CONTRIBUTING.md.
@playcademy/api-core
: API handlers used by sandbox@playcademy/data
: Database schema and types@playcademy/sdk
: JavaScript SDK for game development/templates
for example integrationsThe sandbox is distributed as a standalone npm package for use in game development. It can be installed globally or as a development dependency in game projects.
FAQs
Local development server for Playcademy game development
The npm package @playcademy/sandbox receives a total of 13 weekly downloads. As such, @playcademy/sandbox popularity was classified as not popular.
We found that @playcademy/sandbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.