Developer Tool / Completed
SLSM
Serverless Management and Deployment Automation CLI
Apr 2022 — May 2022
Overview
SLSM - Serverless Management CLI - is a Node.js command-line utility I built to simplify working with projects containing multiple Serverless Framework services.
The idea came from a very small but persistent piece of developer friction: moving between directories, installing dependencies, finding the correct service, and repeatedly running sls deploy.
None of those steps are particularly difficult individually, but they add up quickly when working across a project made up of many independently deployable services.
SLSM reduces that workflow to a single command.
It can search through a project for Serverless services, identify which services can be installed or deployed, and then perform those operations directly. It supports both a guided interactive interface and command-line arguments for situations where speed matters more than prompts.
Like many of my smaller developer tools, SLSM started with a very simple question:
Why keep repeating several commands when one can do the job?
The problem
Serverless applications are often composed of many small services rather than a single deployable application.
That creates a perfectly manageable but repetitive development workflow.
A developer may need to navigate into one service, install its Node dependencies, deploy it, move back through the directory tree, locate another service, and repeat the process.
The problem becomes more noticeable when switching branches or Node.js versions.
A branch change may introduce different dependencies, while switching versions through a tool such as nvm can require dependencies to be reinstalled. In a sufficiently large project, verifying every service manually becomes tedious and easy to forget.
The directory structure can also become deeply nested. A project might contain separate frontend, middleware, and backend areas, each containing further directories and individual Serverless services.
The Serverless Framework itself already provides the commands required to manage each service.
The missing piece was orchestration.
I wanted a tool that could start at the project root, find the relevant services automatically, determine what action was required, and execute the existing tooling without making the developer manually navigate the repository.
The solution
SLSM provides a single CLI interface over the repetitive parts of managing Node.js Serverless Framework projects.
The application can be run simply as:
slsm
This starts an interactive workflow that prompts the developer for the required action and service.
For faster workflows, the same behaviour can be controlled directly using command-line arguments. The CLI supports installing dependencies, deploying services, targeting individual services, or combining actions together.
For example, a developer can request installation and deployment together rather than manually executing both operations.
The more useful part, however, is service discovery.
Instead of requiring the developer to know the exact path to every service, SLSM can begin from a project root and recursively locate directories containing the files associated with supported actions.
A package.json identifies a service where dependencies can be installed, while a serverless.yml identifies a service that can be deployed.
This means SLSM can operate against project structures containing multiple applications and nested service directories rather than assuming every service exists at the repository root.
The project therefore acts as a thin orchestration layer around tools that already work well, reducing navigation and command repetition without attempting to replace npm or the Serverless Framework itself.
Architecture & technical approach
SLSM is implemented as a lightweight Node.js CLI application using ECMAScript modules.
The executable entrypoint exposes the slsm command and handles two different interaction styles: direct CLI arguments and an interactive menu.
Argument parsing is handled using Yargs. Flags such as --install and --deploy determine which actions should be executed, while positional arguments are interpreted as target service names. When information is omitted, the application falls back to interactive prompts rather than requiring every option to be supplied upfront.
The application's discovery logic is based around the files that define the underlying workflow:
package.json represents an installable Node.js service
serverless.yml represents a deployable Serverless Framework service
From a supplied root directory, SLSM can search through nested project structures and locate services matching the requested operation.
Once a service has been selected, execution is delegated to the existing ecosystem tools rather than reimplementing their functionality. SLSM effectively orchestrates dependency installation and Serverless deployment commands from one consistent interface.
The CLI experience is deliberately more polished than a collection of shell scripts. The project uses libraries such as Inquirer for interactive prompts, inquirer-fuzzy-path for navigating paths, Chalk and ANSI utilities for terminal formatting, Ora for terminal feedback, and Figlet for its command-line presentation. Process execution is handled through Execa.
This keeps the architecture deliberately small: discover services, determine an action, execute the existing tooling, and return the developer to their work.
Key features
- Automatic discovery of Serverless services within nested projects
- Dependency installation for Node.js services
- Serverless Framework deployment orchestration
- Ability to install and deploy in a single workflow
- Interactive menu-driven interface
- Fast non-interactive CLI mode
- Targeting services by name rather than manually navigating directories
- Multiple service targets in a single command
- Root-directory scanning across larger project structures
- Detection based on package.json and serverless.yml
- Useful after Git branch changes where dependencies may have changed
- Useful when switching Node.js versions through tools such as nvm
- Fuzzy path selection for interactive navigation
- Globally installable slsm executable
- Lightweight wrapper around existing Node.js and Serverless tooling
Technical highlights
- Written in JavaScript / Node.js
- Uses native ES modules
- Yargs for CLI argument and flag parsing
- Inquirer for interactive command-line workflows
- inquirer-fuzzy-path for project and service navigation
- Execa for executing external development commands
- Ora for progress and execution feedback
- Chalk and ANSI tooling for formatted terminal output
- Figlet used to create a recognisable CLI interface
- Filesystem-driven service discovery
- Supports both interactive and automation-friendly execution
- CLI options can be combined, including install-and-deploy workflows
- Published as an npm-compatible CLI package with dedicated binary entrypoints
- Designed around orchestrating existing tools instead of duplicating their functionality
- Demonstrates automation of repetitive developer workflows
- Intentionally small scope with a focus on developer productivity