Local SMS development environment - the Mailtrap for SMS
Test SMS applications without costs, phone numbers, or external dependencies. A complete local development tool that simulates SMS functionality with a beautiful web interface.
- π Zero Setup - Works instantly without configuration
- π± Virtual Phone UI - Beautiful dark mode interface for testing
- π Real-time Updates - WebSocket connections for live message flow
- πͺ Webhook Testing - Forward messages to your application
- π Message Search - Find conversations and messages instantly
- π Performance Testing - Load testing with configurable parameters
- π€ Conversation Flows - Automated message sequences with conditions
- π€ Export Data - Export conversations as JSON or CSV
- βοΈ Flexible Config - File, environment, or CLI configuration
- π¨ Developer First - Designed for modern development workflows
# Install globally via npm
npm install -g @relay-works/sms-dev
# Start the development environment
sms-dev start
# Open in browser
# API: http://localhost:4001
# UI: http://localhost:4000
# Install locally in your project
npm install --save-dev @relay-works/sms-dev
# Add to package.json scripts
{
"scripts": {
"sms-dev": "sms-dev start"
}
}
# Run in your project
npm run sms-dev
// Your application code
const response = await fetch('http://localhost:4001/v1/messages', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
to: '+1234567890',
body: 'Hello from my app!'
})
})
const message = await response.json()
console.log('Message sent:', message.id)
# Start with webhook forwarding
sms-dev start --webhook-url http://localhost:3000/webhook/sms
# Your app will receive webhooks for all messages
// sms-dev.config.js
module.exports = {
apiPort: 4001,
uiPort: 4000,
webhookUrl: 'http://localhost:3000/webhook/sms',
cors: {
enabled: true,
origins: ['http://localhost:3000']
}
}
sms-dev start # Start API and UI servers
sms-dev start --no-ui # Start API only
sms-dev stop # Stop all servers
sms-dev status # Check server status
sms-dev config # Show current configuration
sms-dev init # Generate config file
sms-dev init --json # Generate JSON config
sms-dev config --config custom.js # Use custom config
# Mock phone management
sms-dev mock-phone create --phone +1234567890 --name "Test User"
sms-dev mock-phone list
sms-dev mock-phone delete --phone +1234567890
# Conversation flows
sms-dev flow create --name "Welcome Flow"
sms-dev flow list
sms-dev flow execute --flow-id flow_123 --phone +1234567890
# Data export
sms-dev export messages --format json --output messages.json
sms-dev export conversations --format csv
# Performance testing
sms-dev perf stats
sms-dev perf load-test --messages 1000 --users 10 --duration 60
sms-dev start [options]
Options:
-p, --port <port> API server port (default: 4001)
--ui-port <port> UI server port (default: 4000)
-w, --webhook-url <url> Webhook URL for forwarding
--cors-origins <origins> CORS allowed origins
--no-ui Disable UI server
-v, --verbose Enable verbose logging
-c, --config <file> Configuration file path
SMS_DEV_API_PORT=4001 # API server port
SMS_DEV_UI_PORT=4000 # UI server port
SMS_DEV_WEBHOOK_URL=... # Webhook URL
SMS_DEV_CORS_ORIGINS=... # CORS origins (comma-separated)
SMS_DEV_VERBOSE=true # Enable verbose logging
SMS_DEV_NO_UI=true # Disable UI server
// sms-dev.config.js
module.exports = {
// Server configuration
apiPort: 4001,
uiPort: 4000,
// Webhook testing
webhookUrl: 'http://localhost:3000/webhook/sms',
// CORS configuration
cors: {
enabled: true,
origins: ['*'] // Allow all origins in development
},
// Logging
logging: {
enabled: true,
level: 'info' // 'debug' | 'info' | 'warn' | 'error'
}
}
POST /v1/messages
Content-Type: application/json
{
"to": "+1234567890",
"from": "+15551234567",
"body": "Hello world!"
}
GET /v1/messages?limit=20&offset=0&search=hello&status=delivered
GET /v1/messages/export?format=json&phone=1234567890&from_date=2024-01-01
GET /v1/dev/performance/stats
View Full API Documentation β
import express from 'express'
const app = express()
// Webhook endpoint for sms-dev
app.post('/webhook/sms', express.json(), (req, res) => {
const { id, to, from, body, status } = req.body
console.log('SMS received:', { id, to, from, body, status })
// Process your SMS logic here
res.json({ success: true })
})
app.listen(3000)
// Start sms-dev with webhook
// sms-dev start --webhook-url http://localhost:3000/webhook/sms
// pages/api/webhook/sms.js
export default function handler(req, res) {
if (req.method === 'POST') {
const { id, to, from, body, status } = req.body
console.log('SMS received:', { id, to, from, body, status })
// Process your SMS logic here
res.status(200).json({ success: true })
} else {
res.setHeader('Allow', ['POST'])
res.status(405).end(`Method ${req.method} Not Allowed`)
}
}
// hooks/useSMSTesting.js
import { useState } from 'react'
export function useSMSTesting() {
const [messages, setMessages] = useState([])
const sendTestMessage = async (to, body) => {
const response = await fetch('http://localhost:4001/v1/messages', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ to, body })
})
const message = await response.json()
setMessages(prev => [...prev, message])
return message
}
return { messages, sendTestMessage }
}
# Check what's using the port
lsof -i :4001
# Use different ports
sms-dev start --port 4002 --ui-port 4003
# Install with correct permissions
sudo npm install -g @relay-works/sms-dev
# Or use npx without global install
npx @relay-works/sms-dev start
# Debug configuration
sms-dev config
sms-dev start --show-config
# Reset configuration
rm sms-dev.config.js
sms-dev init
If you're working with the sms-dev source code:
# Clone repository
git clone https://github.com/pcdkd/smsdev.git
cd smsdev
# Install dependencies
npm install
# Build packages
npm run build
# Run local development
./apps/sms-dev/dist/cli.js start
We welcome contributions! Please see our Contributing Guide for details.
# Fork and clone the repository
git clone https://github.com/your-username/smsdev.git
cd smsdev
# Install dependencies
npm install
# Build all packages
npm run build
# Run tests
npm test
# Start development server
npm run dev
MIT Β© Relay
- Documentation: smsdev.app
- GitHub: github.com/pcdkd/smsdev
- npm: npmjs.com/package/@relay-works/sms-dev
- Relay Platform: relay.works
Made with β€οΈ by the Relay team
# Test automation - Sun Jun 30 11:08:30 EDT 2025