Project

locport

0.0
No release in over 3 years
Overview of localhost ports used across projects. Prevent conflicts.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.3
 Project Readme

locport

Manage local ports across projects. Prevent conflicts. Overview all your projects, hosts and ports.

Inspired by DHH's Rails World 2025 keynote part about how 37Signals deals with serving apps in development.

Rails World 2025 Keynote

Introducing the .localhost file convention

list success

A project can define within it's root, the .localhost file, that lists local hosts with ports that the project uses.

Format of this file is a simple list of <host>:<port> separated by newlines. For example:

hello.localhost:3001
another.service.localhost:3002

A single project can have zero, one or multiple domains associated to it.

To add the project to locport, simply locport index [PATH]. Now you can overview hosts and ports with locport list and easily discover conflicts across any number of projects.

Installation

Ruby is required.

gem install locport

Usage

Adding hosts with ports to a project

To create and/or add to .localhost file, from within your project directory:

locport add <url>[:<port>]

# Example where a unique port is automatically assigned by locport
locport add myapp.localhost

# Example with a user specified port
locport add myapp.localhost:30000

Listing projects and hosts

locport
# OR
locport list

If any conflicts are detected, they will be displayed and program exits with error code 1.

list conflicts

TODOs

  • Handle empty lines in dotfile
  • Some hostname validation during add
  • Remove project from the index
  • Test suite

Development

PRs are welcome. To set up locally from within the checked out repo:

# Install dependencies
bundle

# Run commands with dev code
ruby -Ilib/ bin/locport