title: | Instant websites with the Val Town CLI
|
---|---|
description: | Write your scripts on the internet |
pubDate: | 2025-04-17T00:00:00.000Z |
author: | Wolf Mermelstein |
I love tools. I also love simplicity and versatility. What I don't love is friction. So I made a tool to ship a TypeScript file on your computer to the internet instantly, with no bundling, configuring, or certs, using Val Town's API. Instant websites!
Since the day I started learning to code, I've ended up writing a ton of random, often one-off, tools, scripts, and programs for myself pretty regularly, to solve hyper-specific problems that make my life smoother. Most of these aren't full-fledged programs ready to blog about, because they're simple, local programs, packaged for my own use. I'm sure everyone has their own garden of these.
From time to time, though, I ask myself - as a web developer, why are all my scripts, well, scripts? The answer is always that making web-based tools is just too much work, and it's never simple. You (or, now, your favorite LLM) can write a tiny program in 45 seconds. But to ship it to the internet is a 15 minute affair, at best. Earlier this year, I found Val Town, a website that lets you put your TypeScript in a text box, and instantly get a website. So cool!
And so, since starting using Val Town, I've created a new net of, random scripts, but this time they're websites! Anyone can use or fork them, with no build or installation necessary. It makes scripting all the more fun!
When I started, Val Town was a website for building websites. It still is. But I'm just too drawn to my Linuxy, Neovim+tmux, ways. For me, it was a place to paste my code to ship it, and less of a development platform. I immediately craved a local dev experience more robust than this initial copy+paste flow.
So, of course, I solved this debacle with a new custom tool.
This would be a be-all end-all program for creating instant websites. This was ValFS: a FUSE file system for Val Town, built using Val Town's API. The initial concept was very simple—you'd directly edit off Val Town, but locally, similar to how one might edit Google Docs files with RClone.
FUSE is a Linux protocol that lets you handle file system syscalls however you'd like, in userspace, like writing or reading chunks of files. I built ValFS in go with go-fuse, and an openapi-generator go SDK. It would expose a folder with all your Vals in it. If you wrote to a Val, it would automatically upload the new modifications to Val Town. There were no state issues, since if it failed to upload, the write itself would be rejected.
And it worked! You could write websites as files on your computer, in your editor, with your local tools. So much simplicity and versatility! No friction.
But this tool was mostly built for my specific workflow and setup. There were a lot of compatibility issues on non-Linux. Fuse on Mac is finicky, requires a kernel module or very early-stage NFS adapter, and, while possible, had too much friction. Also, implementing a fuse backend was just plain complicated. The way valfs
worked, on every write syscall, valfs
would have to parse the file, extract metadata, and do multiple API calls.
After making ValFS, and still obsessed with the platform, I joined Val Town as an intern, and created what I share here, the next generation of the Val Town local dev experience, vt
! The new vt
functions as a synchronization tool, and is an interactive CLI built entirely in Typescript w/ native Deno, a modern JavaScript runtime, so it's inherently cross-platform.
It handles a lot of complicated synchronization situations like detecting renames and keeping operations atomic.
If you already have Deno you can run vt
now with vt run -A jsr:@valtown/vt
to quickly try it out! And, if you don't, Deno is easy to install, and you can get it here.
vt
leverages Val Town to let you instantly ship Typescript files on your computer to a deployed, scalable, HTTPS website (or API). Just code → prod!
Watch me create and ship a website in seconds, from scratch...
With vt
, you can:
- Watch a folder for changes, deploying changes to prod in less than a second of saving
- Manage branches, to easily switch between separate deployments, like a prod and test branch, or just to keep yourself organized
- Remix or create brand-new Val Town projects directly from your command line
We designed vt
to work much like git
; Val Town projects act somewhat like repos, so most commands should come naturally. vt
can resolve complex deltas between Val Town and a local folder of Typescript and text files, automatically detecting file changes like renames and modifications. You can work locally, and, when you're ready, ship with vt push
.
It's also fast! Operations happen concurrently where possible. Watch 62 files get cloned in 0.17 seconds!
vt
lets you create new projects right from your command line. You can remix a very minimal HTTP, Hono, React, template, with "vt remix @std/reactHonoTemplate myNewVal
", and then "cd myNewVal
". Or, you can create a blank project from scratch with "vt create
".
Then, just run "vt watch
" so that vt
automatically does a "vt push
" whenever changes are detected in the folder.
vt
unlocks many new workflows previously not possible on Val Town.
Believe it or not, this blog itself was written on Val Town, with vt
to sync as I typed it, for a WYSIWYG editing experience.
Something I didn't anticipate back when writing ValFS, but we've seen a ton of, is using vt
with local AI tools.
We've seen a lot of interesting VT projects, like Geoffrey Litt's Stevens project, a really cool AI personal assistant telegram bot, built locally with cursor and vt
. I've been working on an IOT maintenance request "magic wand" project using Neon Postgres, and doing migrations locally with DrizzleKit, using vt
to sync schemas, and with the help of Claude Code. And, most recently, we built Val Town's new Val search on Val Town itself, built largely with Claude Code and VT.
Being able to use your local dev tools, whether AI ones like Cursor and Claude Code, or a highly customized Neovim and CLI tools like Ripgrep or Drizzle Kit, and the full Deno language server is very powerful!
With vt
, you can edit your Vals locally with your favorite editors.
At this point, vt
is stable and ready for use.
But we're excited to keep improving vt
! We have a lot planned: automatic reloading during "vt watch
" with a zero-config companion browser extension, a Typescript library exposing vt
's internal functionality (like pushing & pulling delta resolution), commands to manage PRs, and more! We love getting feedback and seeing what the community builds! Please join our discord server to share any and all feedback, and how VT has shaped your workflows.
vt
is open source, and the Github can be found at https://github.com/val-town/vt, and the JSR page here!
For the curious, I've written more about building VT and ValFS here.