What is Instant Preview?
https://www.instantpreview.dev allows you to upload one or many html files for instant, private, temporary preview of your website.
It's like Netlify or Vercel or Cloudflare Pages but without the hassle.
No accounts, no projects, just upload files and see them online.
Uploading files
How to upload files with drag & drop:
- go to https://www.instantpreview.dev and drag one or more files from a file manager
- you can drag a whole directory
- or click
Select files for upload
button and use file picker to choose files for upload - you can drop zip files and we'll extract files inside it
Upload files with curl:
curl -F [email protected] -F [email protected] https://www.instantpreview.dev/upload
curl --upload-file local-file.html https://www.instantpreview.dev/name-on-server.html
- upload directory:
zip -9 -r website.zip www
this will create website.zip file with the content of www directorycurl --upload-file website.zip https://www.instantpreview.dev/upload
this uploadswebsite.zip
. We'll extract the files inside zip files
If upload is successful, the server returns URL under which the files are hosted. For example: https://www.instantpreview.dev/p/7DxnWY/
The uploads are private in that they are hosted under randomly generated url that is impossible to guess.
The limits
Instant Preview is not a web hosting service. It's meant to allow you to quickly preview HTML file or a website.
The largest individual file can be 5 MB.
Total size of uploaded files is less than 10 MB.
We don't abort downloads if they are larger than allowed, we just won't upload large files and only upload up to 10 MB of files.
The upload expires in about 2 hrs.
We won't upload executable files and video files.
SPA (Single Page Application) mode
In SPA mode, if a file doesn't exist and there is
index.html
, we'll serve index.html
.
This is for Single Page Applications where URL routing happens in the on the client side.
You can see the SPA status on
/p/${site}/_dir
page.
You can toggle SPA mode by visiting
/p/${site}/_spa
You can set SPA mode during upload from cmd-line by uploading to
https://www.instantpreview.dev/upload?spa
Misc features
You can use
_dir
(/p/${site}/_dir
) to list files in your site.
We support clean urls i.e.
foo.html
file is also available under foo
.
Behavior for missing files:
- in SPA mode, we return
index.html
, if exists. If doesn't exist, we follow non-SPA logic - if there is
404.html
file, we serve that - otherwise we'll list available files (same as
If a file doesn't exist and there is
404.html
file, we serve that.
Contact me
If you have question, feature requests etc., here's how you can reach me.
But why?
I was just annoyed by how hard it is to preview a website in development with Netlify / Vercel / Cloudflare Pages (yes, I've used them all).
It's possible but there's unnecessary friction. When I'm in development mode I just need a quick, temporary preview.
I got inspired by transfer.sh. They removed all friction from sharing files.
I decided to remove all friction from previewing websites.
Self hosting
You can self host this code on any service that can run Go services e.g. Heroku, fly.io, Digital Ocean Apps. Here are instructions for hosting on $7/month plan on https://render.com:
- optional: for the repository into your GitHub account
- sign up for https://render.com/ account and go to https://dashboard.render.com/
- click
New
button and pickWeb Service
- select either your forked repo or enter
https://github.com/kjk/instaprev
- change
Start Command
to./app -run
- change
- you can run it on the cheapest $7/month plan
- recommended: click 'Advanced' button and change
Auto Deploy
toNo
(especially if you usedhttps://github.com/kjk/instaprev
)
The technology
It's a very small project (took me 4 days to make it). Here's the technology I used
- Go for the backend
- mostly plain html / javascript + a dash of alpine.js to render lists
- deployed to http://render.com (smallest, cheapest $7 instance is more than enough)
The code is at https://github.com/kjk/instaprev