@scriptdb/cli
v1.1.2
Published
CLI tool to start and manage ScriptDB server
Downloads
515
Maintainers
Readme
ScriptDB CLI
Command-line interface for ScriptDB - Database management with TypeScript scripting.
Installation
Install from npm:
npm install -g @scriptdb/cli
# or
bun add -g @scriptdb/cliInstall from source:
git clone <repo>
cd scriptdb
bun install
bun run build
npm linkUsage
Server Management
Start the server in daemon mode (background):
scriptdb start -dStart the server in foreground:
scriptdb startStop the server:
scriptdb stopRestart the server:
scriptdb restart -dCheck server status:
scriptdb statusView server logs:
scriptdb logsInteractive Shell
Start the interactive shell (requires server to be running):
scriptdb shellShell commands:
.exit,.quit- Exit the shell.help- Show help.dbs- List all databases.use <name>- Switch to a database.create <name>- Create a new database
Execute TypeScript code:
> const x = 1 + 1
> x
2
> [1,2,3].map(n => n * 2)
[2, 4, 6]Configuration
Configuration file: ~/.scriptdb/config.json
Example:
{
"host": "localhost",
"port": 1234,
"users": [
{
"username": "admin",
"password": "your-password",
"hash": false
}
],
"folder": "databases",
"secure": false
}Package Management
Install packages to ScriptDB:
# Install to ~/.scriptdb/packages
scriptdb add lodash
scriptdb add axios express
# Install to current directory
scriptdb add --local lodashRemove packages:
# Remove from ~/.scriptdb/packages
scriptdb remove lodash
# Remove from current directory
scriptdb remove --local lodashMonitoring
View real-time logs:
scriptdb logsMonitor performance (CPU, memory, uptime):
scriptdb monitCommands
| Command | Description |
|---------|-------------|
| scriptdb start [-d] | Start server (-d for daemon/PM2 mode) |
| scriptdb stop | Stop the running server |
| scriptdb restart [-d] | Restart the server |
| scriptdb status | Check server status and view metrics |
| scriptdb logs | View real-time logs |
| scriptdb monit | Monitor performance (CPU, memory, uptime) |
| scriptdb shell | Start interactive shell |
| scriptdb add <pkg> | Install packages to ~/.scriptdb |
| scriptdb add --local <pkg> | Install packages to current directory |
| scriptdb remove <pkg> | Remove packages from ~/.scriptdb |
| scriptdb remove --local <pkg> | Remove packages from current directory |
Building
Build for all platforms (local)
bun run build:binaryBuild using Docker (recommended for cross-platform)
bun run build:dockerThis will build binaries for all platforms inside a Docker container.
Build for specific platform
bun run build:linux-x64
bun run build:linux-arm64
bun run build:windows-x64
bun run build:darwin-x64
bun run build:darwin-arm64
bun run build:linux-x64-musl
bun run build:linux-arm64-muslDevelopment
bun run devFiles
- Config file:
~/.scriptdb/config.json - Ecosystem config:
~/.scriptdb/ecosystem.config.js(PM2) - PM2 logs:
~/.scriptdb/pm2-*.log - Databases:
~/.scriptdb/databases/ - Packages:
~/.scriptdb/packages/
Changelog
1.1.2 (2025-01-16)
Added
- Native
scriptdb logscommand to view real-time logs - Native
scriptdb monitcommand to monitor performance - Native
scriptdb restartcommand to restart the server - Native
scriptdb stopcommand to stop the server - Dynamic version reading from package.json
- ESLint configuration for TypeScript linting
Fixed
- Fixed TypeScript module resolution errors
- Fixed test command to continue gracefully when packages have no tests
- Improved error handling and Windows compatibility
License
MIT
