node-sail
v0.1.9
Published
Docker management for Node.js - Laravel Sail for Node
Downloads
23
Readme
Node Sail
Docker management for Node.js, inspired by Laravel Sail.
Quick Start
npm install -D node-sail
npx sail init
npx sail upThe init wizard will ask you to pick an application type (Static HTML, React, Next.js, Express, or none) and which backend services to include. The default setup gives you a static HTML app with PostgreSQL, Redis, and Mailpit.
Commands
Setup
npx sail init # Initialize in current project
npx sail add <services...> # Add services (e.g. sail add mongodb kafka)
npx sail remove <services...> # Remove services (e.g. sail remove redis mailpit)
npx sail doctor # Check system requirementsLifecycle
npx sail up [services...] # Start services
npx sail down # Stop and remove containers
npx sail stop [services...] # Stop without removing
npx sail start [services...] # Start stopped containers
npx sail restart [services...] # Restart services
npx sail build [services...] # Rebuild images
npx sail pull [services...] # Pull latest imagesDevelopment
npx sail shell <service> # Open shell in a container
npx sail exec <service> <cmd> # Run command in a container
npx sail npm <command> # Run npm in the app container
npx sail node <script> # Run node in the app container
npx sail logs [service] # View logs
npx sail ps # List running containersConfiguration
Running sail init generates a sail.config.mjs in your project root:
export default {
name: 'my-app',
framework: 'static',
runtime: {
version: '20',
packageManager: 'npm',
port: 3000,
},
services: ['postgres', 'redis', 'mailpit'],
};Add or remove services at any time:
npx sail add mongodb elasticsearch
npx sail remove mailpit
npx sail down && npx sail upApplication Types
| Type | Container | Description |
|------|-----------|-------------|
| Static HTML | nginx:alpine | Serves public/index.html -- default, works immediately |
| React | node:alpine | Runs react-scripts start |
| Next.js | node:alpine | Runs next dev |
| Express | node:alpine | Runs node src/index.js |
| None | -- | Backend services only, no app container |
Available Services
postgres, mysql, mongodb, redis, memcached, rabbitmq, kafka, elasticsearch, mailpit, minio
Requirements
- Docker 20.10+
- Node.js 18+
License
MIT
