• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
wolf

wolf

Electric

Static site hosting on Val Town
Remix of std/reactHonoStarter
Public
Like
4
Electric
Home
Code
7
backend
3
cli
2
shared
2
.cursorrules
.vtignore
README.md
deno.json
Branches
1
Pull requests
Remixes
1
History
Environment variables
4
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/3/2025
Viewing readonly version of main branch: v56
View latest version
README.md

Simple File Storage API with Static Site Hosting

A minimalist file storage API built with Hono and Val Town's blob storage. It also serves HTML files as a static website.

Authentication

API endpoints require bearer token authentication. Set the MASTER_BEARER environment variable in your Val Town settings.

Include the token in your API requests:

Authorization: Bearer your-secret-token

Note: Static site content (HTML, CSS, JS, etc.) is served without authentication.

API Endpoints

Upload a File

POST /route

Form Parameters:

  • file: The file to upload
  • filename: The name to save the file as

Example:

curl -X POST https://your-val.web.val.run/route \ -H "Authorization: Bearer your-secret-token" \ -F "file=@/path/to/your/file.pdf" \ -F "filename=document.pdf"

Get a File via API

GET /route?filename=your-filename

Query Parameters:

  • filename: The name of the file to retrieve

Example:

curl -X GET "https://your-val.web.val.run/route?filename=document.pdf" \ -H "Authorization: Bearer your-secret-token"

List All Files

GET /route

Example:

curl -X GET https://your-val.web.val.run/route \ -H "Authorization: Bearer your-secret-token"

Delete All Files

DELETE /

Example:

curl -X DELETE https://your-val.web.val.run/ \ -H "Authorization: Bearer your-secret-token"

Static Site Hosting

All files stored in the blob storage are also served as a static website. HTML files are served with the correct content type.

Accessing Static Content

Simply navigate to the URL path matching your file:

https://your-val.web.val.run/your-file.html

Directory Structure

  • The root URL (/) serves index.html if it exists
  • URLs without file extensions will try to serve an index.html file in that path

For example:

  • /about will try to serve /about/index.html
  • /blog/post-1 will try to serve /blog/post-1/index.html

Storage Details

All files are stored in Val Town's blob storage with the prefix vt-docs/ to ensure safety and organization.

Safety Features

  • The DELETE endpoint only removes files with the vt-docs/ prefix
  • Authentication is required for all API operations
  • Static site content is served without authentication for public access
  • Input validation using Zod ensures data integrity
  • Error handling provides clear feedback
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.