Terminalwire

Ship a CLI for your web app. No API required.

Terminalwire is in private beta. If you'd like early access shoot me an email, brad@terminalwire.com, and tell me about your project.

Discuss Your Requirements

A dramatically easier way to build terminal apps 🧘


Terminalwire streams command-line applications over WebSockets from your web server to a thin client installed on peoples’ terminals.

That means developers don’t have to worry about building web APIs and instead can focus on building delightful command-line user experiences.

Achieve 10× more for ⅒ the effort 💪


Solo developers and teams create and maintain command-line apps without the burden of building APIs, managing versioning, packaging binaries, or handling incompatible outdated clients.

New features are deployed instantly to the server, just like a web app. No client-side updates necessary. No breaking changes. Deployments can happen frequently, even on Fridays.

Works with existing web stacks 💃


Plug Terminalwire into your favorite web framework, then connect it to any command-line utility library on the server and you’re ready to go.

Developers are no longer limited to “what runs best on the client”–they are free to use their favorite command-line library in their language of choice.

How it Works

Terminalwire streams terminal I/O between a web server and client over WebSockets. This means you can use your preferred command-line parser, like Thor, Rake, or OptParser, on Rails to deliver a delightful command-line application experience to your users.

Getting Started

Terminalwire is in private beta. This section illustrates how it will integrate with Rails apps when it’s released to the public. Terminalwire will be available for other popular web frameworks outside of Rails and Ruby.

Install Terminalwire

Add the Terminalwire Rails gem to your app.

$ bundle add terminalwire

Then install Terminalwire in your Rails app.

$ rails g terminalwire:install my-app

Configure the terminal

The rails g terminalwire:install my-app command creates files that you may configure for your application’s needs.

Thor command-line parser

The ./app/terminals folder has a application_terminal.rb that’s a Thor command-line parser.

# ./app/terminals/application_terminal.rb
class ApplicationTerminal < Thor
  # Replacs $stdio with Terminalwire's WebSocket IO streams.
  include Terminalwire::Thor

  # Name of your app's binary. Thor uses this to generate help messages.
  self.basename = "my-app"

  # It's always good to include a version for your CLI so users know what they're running.
  desc "version", "Prints the version of your app"
  def version
    puts "1.0.0"
  end

  # Example CLI application command that lists blog posts from a current user.
  desc "posts", "Prints a list of all blog posts"
  def posts
    current_user.posts.each do |post|
      puts post.title
    end
  end
end

Routes configuration

The ./config/routes.rb file mounts the ApplicationTerminal in a Terminalwire::Thor::Server WebSocket server to the /terminal endpoint. This is the URL your client will connect to.

# ./config/routes.rb
Rails.application.routes.draw do
  match '/terminal',
    to: Terminalwire::Thor::Server.new(ApplicationTerminal),
    via: [:get, :connect]
end

Terminalwire binary stub configuration

Terminalwire generates a binary stub in the Rails ./bin folder that you may use to interact with your application in a development environment. You may need to change the host if the server is running on a different port.

#!/usr/bin/env terminalwire-exec
url: "ws://localhost:3000"

To test the intergration, restart your Rails server, then run ./bin/my-app version in your terminal and you should see the following:

$ ./bin/my-app version
1.0.0

Going to production

Production distributions require a Terminalwire client license per endpoint.

  1. Get a license.

    $ terminalwire client my-app.com/terminal
    The endpoint wss://my-app.com/terminal is not licensed.
    
    We'll email you a license agreement.
    
    What is your email address? me@example.com
    

    If you don’t have a license for this endpoint, Terminalwire will prompt you to request one. Licenses for non-commercial use are available at no cost.

  2. Build a client.

    Once you have a license, Terminalwire will build the client binaries for the platforms you need.

    $ terminalwire client my-app.com/terminal
    Building terminalwire client for my-app.com/terminal. We'll email you when it's ready.
    Terminal wire clients are available for macOS, Windows, and Linux.
    

    When the build is done, we’ll send you a page with instructions onw how to download the client.

That’s it! When users run the terminal app, it streams input and output to the Terminalwire middleware running on your web server. Updates on the server are automatically reflected on the client side.

Frequently asked questions

How is Terminalwire different from a REST API?

Terminalwire is a WebSocket-based protocol that streams terminal I/O, and other channels, between a web server and client. This allows you to use your preferred command-line parser within your favorite web server framework to deliver a delightful CLI experience to your users.

Can I use Terminalwire with other web frameworks?

Yes! Terminalwire is designed to be integrated with any web framework and server that supports WebSockets.

How is Terminalwire different than SSH?

SSH was created in 1995 to secure, encrypted interactive remote shell sessions. It includes features not needed by modern command-line apps for web applications, such as file transfer, port forwarding, and public-key authentication. Today’s command-line applications for web apps need to do things SSH can’t, like open a web browser on the client to authenticate via the web application. Terminalwire was built specifically to solve problems that modern command-line web apps demand that SSH can’t.

How do I handle authentication and authorization?

Terminalwire integrates with your existing web app’s authentication and authorization mechanisms. You can use the same authentication and authorization methods you use for your web app.

Is Terminalwire encrypted?

Yup. Terminalwire uses the same TLS encryption as your web server and browser, which is WebSockets Secure (WSS) in a production web environment.

How will it be licensed?

Terminalwire will be available under a dual license. One license will be freely available for personal use. Commercial licenses will also be available for organizations.

How can I get early access to Terminalwire?

I’m working with select customers in private beta to ensure that Terminalwire meets their needs and integrating it into my own production web applications. I expect to release Terminalwire to the public in the coming months. If you’d like to integrate Terminalwire into your stack today, email brad@terminalwire.com and let’s talk about your requirements.

Sound good? Let's talk! 🤗

Whether your team is building a new command-line app or simplifying existing infrastructure, I'd love to see how we can work together.

Discuss Your Requirements