npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

katon

v0.10.7

Published

Automatically starts your development servers so that you can be more productive. Servers are accessible on local .ka domains.

Downloads

55

Readme

katon

Access your dev servers by their names

katon is a development tool that makes dev servers accessible on beautiful local .ka domains. It also autostarts/stops them for you.

katon supports any server: Node, Ruby, Python, Go, Java, PHP, ... that can be started with a command-line and runs on OS X.

Note: for a lighter and cross-platform version, see hotel.

Install

Make sure Node is installed first, then:

$ npm install -g katon

To manually install katon, you can run sudo katon install && katon start.

Known issue: if Apache is running, it needs to be stopped to avoid conflict with katon.

Add servers

$ katon add 'nodemon'
$ katon add 'npm start'
$ katon add 'grunt server'
$ katon add 'rails server --port $PORT'
$ katon add 'python -m SimpleHTTPServer $PORT'
$ katon add 'php -S 127.0.0.1:$PORT'

To add a server with a different name than its directory.

$ katon add 'grunt server' my-custom-name
Application is now available at http://my-custom-name.ka

Note: it's important to use ' and not " to avoid $PORT to be evaluated.

Port is dynamically set by katon using PORT environment variable but can be passed as a parameter using $PORT.

In case your server doesn't accept a port parameter, you can retrieve the PORT environment variable in your code. For example, for a Node server you would write something like:

var port = process.env.PORT || 3000;

The same technique can be applied with other languages too.

How it works

  • When you add a server using the katon add command, its configuration is saved locally to ~/.katon/hosts/<app> and an equivalent ~/.katon/logs/<app> directory is also created.
  • The server is not started until you make your first request to your <app>.ka domain.
  • If no request is made to your <app>.ka server within an hour, then katon automatically stops it. Therefore, Katon automatically manages resources by starting only needed servers and stopping them when they're not used.

Subdomains

When adding a server, you can access it by its URL http://app.ka. But you can also use subdomains (e.g. http://foo.app.ka, http://bar.app.ka, ...).

If you want to map a server to a subdomain, let's say api.app.ka, simply use katon add <cmd> api.app.

Access from other devices

Using xip.io you can access your servers from other devices (iPad, iPhone, ...) on your LAN.

# Let's say your local address is 192.168.1.12
http://<app_name>.192.168.1.12.xip.io/

You can find your local address using ifconfig or going to index.ka

Remote access behind NAT/firewall

Using ngrok.com you can share access to your servers with others, when running behind a firewall or NAT.

First, follow the instructions to install ngrok, then register on the site to enable custom subdomains.

Then run ngrok with your application name as the subdomain:

ngrok http -subdomain app_name 80

This exposes port 80 to the internet on app_name.ngrok.io. Use at your own risk: all of your web hosts are accessible on this port while ngrok is running.

Access using HTTPS

You can also use HTTPS to access your servers https://<app_name>.ka.

Logs

Server logs are stored in ~/.katon/logs/<app_name>.log, to view them you can use:

$ katon tail [app_name]
$ katon tail all # View all logs

Version managers

katon works with any version manager, simply set the desired version before adding your server and katon will remember it.

$ nvm use 0.11 && katon add 'npm start'
$ rbenv local 2.0.0-p481 && katon add 'rails server --port $PORT'

Depending on your version manager, you may need to add environment variables.

$ rvm use ruby-2.0.0-p576 && katon add 'bundle exec unicorn' --env GEM_PATH
# Will use GEM_PATH previously set by rvm

For Node users, to keep access to katon CLI accross Node versions, add an alias to your .profile and reopen the Terminal.

echo "alias katon=`which katon`" >> ~/.profile

Troubleshoot

Run katon status or check ~/.katon/daemon.log.

If you're stuck, feel free to create an issue.

Uninstall

$ npm rm -g katon

This will run the uninstall script wich does basically katon stop && sudo katon uninstall. To remove katon completely, run also rm -rf ~/.katon.

Credits

  • Pow for daemon inspiration.
  • Powder for CLI inspiration.

License

katon is released under the MIT License.