Images
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.
Viewing readonly version of main branch: v10View latest version
A minimal image hosting service that allows users to upload images and view the last 4 uploaded images.
- / - View the last 4 uploaded images (newest first)
- /add - Upload form for new images
- Automatic cleanup: images are deleted when there are 4 newer images
- Mobile and desktop friendly
- No frontend JavaScript required
- File size limit: 10MB per image
- Supports common image formats (JPEG, PNG, GIF, WebP)
- Built with Hono framework
- Uses SQLite for metadata storage (filename, content type, file size, upload date)
- Uses Val Town Blob storage for image files (stored as base64)
- Images are automatically cleaned up when more than 4 are uploaded
- Responsive design with CSS Grid and Flexbox
- Server-side rendering with no client-side JavaScript
backend/index.ts- Main application entry point (HTTP trigger)backend/database/migrations.ts- Database schema initializationbackend/database/queries.ts- Database operations and image managementfrontend/style.css- Responsive CSS styling
- Visit the root URL to see uploaded images
- Click "Upload New Image" to go to the upload form
- Select an image file and click "Upload Image"
- You'll be redirected back to the home page to see your uploaded image
- Only the 4 most recent images are kept; older images are automatically deleted
GET /- Home page with image galleryGET /add- Upload form pagePOST /add- Handle image upload (multipart/form-data)GET /image/:blobKey- Serve individual imagesGET /frontend/style.css- CSS stylesheet