13 comments

[ 4.6 ms ] story [ 41.0 ms ] thread
I've built a thing for myself and maybe it'll be useful for others.

https://www.instantpreview.dev/ is like an instant, temporary Netlify or Vercel or Cloudflare Pages etc.

The difference? No hassle (no account needed) but also not permanent. Uploaded website expires after ~2 hrs

Why build it?

I have several projects where I generate static website. I often want to preview it before deploying.

Both Vercel and Netlify have cli that allows creating a preview but there's a lot of ceremony (need an account, need to create a project, need to create access token, keep the tokens secret).

So I made Instant Preview where you don't need any of that. Just upload files either by drag&drop in the browser or from cmd-line with curl and I'll create a private (hosted under random url), temporary (expires in ~2 hrs) preview of a static website.

It's not a web hosting service, just for previews. That's why expires in 2 hrs.

Can also upload from code (do a POST to https://www.instantpreview.dev/upload with either form-encoded name/content or raw ZIP file). Will return a URL for the content.

Concept inspired by transfer.sh, except for static websites and not files.

I’m a forty year old idiot that still just uses a web server running on a VPS. If I want publicly accesible preview I'll scp them to a temp folder on the web server. I am probably missing out on something by not using Netlify but I still haven't been able to figure out what. (Caveat, I’m the sole developer on all my projects; maybe that affects the calculus somehow)
(comment deleted)
Most SSGs expect the site to be deployed to the root of a domain, not in a subdirectory. Unless all of your URLs are relative (including fonts, css, anything in js, et c) your approach probably won't work.

Also, your sole VPS will fall over nearly instantly with any significant amount of traffic; the web is a lot bigger in terms of eyeballs these days than it was when we started out.

These static services aren't bound by the capacity of a single machine.

> Also, your sole VPS will fall over nearly instantly with any significant amount of traffic

Wow, haha...no. Especially not with a static site. Even for a wordpress site, a $5 VPS can easily handle in the tens of millions of hits per day, and if that's not enough just add a CDN in front.

If they’re evenly distributed throughout the day, you have a gigabit port, and aren’t cpu throttled because shared hardware.

A $5 VPS can handle less than a thousand or two connections per second, generally, and will fall over (even serving a static site) if linked simultaneously from a big subreddit and the HN front page during PST business hours.

Using Netlify or a service like it saves you having to administer and keep running an httpd, and “just add[s] a cdn in front”. It’s also free, and not $5.

I do the same. Need to handle traffic? Cloudflare.
Netlify shines in a git based workflow with teams (deploy previews on every pull request, collaborative tools, etc). For a solo dev, I can understand the limited appeal if you already have a workflow that works for you.
Is it protected against zip bombs and ../../ style pathname traversal?
My first thought too. I created a simple directory:

     mkdir tmp/
     cd tmp/
     ln -s /etc/passwd index.html
Then zipped that up, keeping the symlink:

     zip -r --symlinks tmp.zip tmp/
And it showed only the filename, rather than the server contents. I didn't explore further.
I don’t know about Vercel, but I know Netlify supports drag and drop file uploads on https://app.netlify.com/drop

They’re ephemeral (only accessible for a day or so unless they’re claimed) and don’t require an account or repo.

Wow, I have used Netlify for years, but never knew about this feature. Thanks! This is handy
Replying to OPs comment [0] that is showing no reply button for me (maybe a HN bug)

For most purposes running a local server in localhost is much easier for testing. There are plenty of options for dev local servers (usually one on every coding stack plus for one for every major editor)

[0] https://news.ycombinator.com/item?id=28686148