start-repl Command
Interface
The command starts an interactive REPL session with the following signature:
blognami start-replParameters
No parameters required.
Examples
# Start an interactive REPL session
blognami start-repl
# The REPL provides a prompt for interactive JavaScript execution
blognami > Description
The start-repl command is a development tool that launches an interactive Read-Eval-Print Loop (REPL) environment for exploring and debugging Blognami applications. It provides:
- Interactive JavaScript environment - Full JavaScript execution with async/await support
- Service injection - All registered services automatically available as global variables
- Database exploration - Interactive database queries and operations
- Configuration inspection - Access to application configuration and settings
- View testing - Test view rendering with different parameters
- Command execution - Run commands interactively via
runCommand()
Key Features
Automatic Service Access
All registered services are available as global variables:
blognami > const db = await database
blognami > await db.users.count()
5
blognami > const cfg = await config
blognami > cfg.database
{ adapter: 'sqlite', filename: 'development.db' }Async/Await Support
Full support for asynchronous operations:
blognami > const users = await database.then(db => db.users.limit(5).all())
blognami > users.length
5Command Integration
Execute commands directly from the REPL:
blognami > await runCommand('list-services')
blognami > await runCommand('generate-service', { name: 'notification' })Interactive Development
Test and prototype features in real-time:
blognami > const html = await renderView('users/index', { users: [] })
blognami > console.log(html)Common Usage Patterns
Database Exploration
// Inspect database contents
blognami > const db = await database
blognami > await db.users.where({ active: true }).count()
blognami > await db.posts.orderBy('created_at', 'desc').limit(10).all()Service Testing
// Test service functionality
blognami > await runBackgroundJob('maintenance')
blognami > const proj = await project
blognami > proj.nameConfiguration Debugging
// Check application settings
blognami > await environment
'development'
blognami > const cfg = await config
blognami > cfg.server.portExit Commands
- Ctrl+C - Exit the REPL session
.exit- Alternative exit command
Related Commands
list-services- View all available services that can be accessed in the REPLshow-config- Display configuration that can be inspected viaconfigstart-server- Start the web server (can be done from within REPL)
Use Cases
- Development debugging - Interactive exploration of application state
- Service testing - Test service APIs before writing application code
- Data inspection - Examine database contents and relationships
- Feature prototyping - Rapidly test new functionality
- Configuration validation - Verify application settings and service setup