"get in loser, we're ditching docker!"
scratches.sh
is a place for your web experiments. Think of it as a local version of codepen.io/JSFiddle or a pure CLI MAMP. It manages a simple directory of experiments (called scratches), registers hostnames in your /etc/hosts file and serves them locally through PHP's builtin server, resulting in an URL like hello-world.sketch:8080. In short: Just type scratch new
in your terminal, give your scratch a name and scratches.sh
will provide you with a directory where you can tinker just like you would on an Apache server.
Why use scratches.sh
?
- Use the tools and IDE you know and trust — instead of a weird in-browser editor that tries to upsell you.
- Real files. On a real hard drive. Navigateable with a real file browser.
- Abstracts away repetitive setup for small web experiments.
curl -sSL https://raw.githubusercontent.com/janoelze/scratches.sh/main/install.sh | zsh
$ scratches
scratches.sh
new - creates a new scratch
ls - lists all scratches
open - opens a scratch in your default browser
start - starts all scratches
stop - stops all scratches
edit - opens a scratch in visual studio code (requires vscode)
tunnel - tunnel a scratch (requires ngrok)
Create a new scratch
$ scratches new
Enter a name for the scratch (optional): hello world
Created scratch 'hello-world'
List all scratches
$ scratches ls
2 running 24031 facebook-api http://facebook-api.scratch:52093
3 running 24291 foursquare-api http://foursquare-api.scratch:60262
4 stopped n/a hello-world n/a
5 running 61123 mastodon-api http://mastodon-api.scratch:64557
6 stopped n/a twitter-api n/a
Open a scratch in your default browser
$ scratches open hello-world
Open a scratch in Visual Studio Code
$ scratches edit hello-world
Delete a scratch
$ scratches rm hello-world
Stopped scratch 'hello-world'
Removed scratch 'hello-world'
Start all scratches
$ scratches start
Started 2 scratches
Shut down all scratches
$ scratches stop
Stopped 2 scratches
Open a public ngrok tunnel to your scratch (requires ngrok to be installed)
$ scratches tunnel "hello-world"