Public
Like
cp-root
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
https://chadparker--16da92e8402011f08f8576b3cceeab13.web.val.run
A caching system to efficiently display all your Val Town HTTP endpoints in a beautiful web interface.
- Fetch all vals from Val Town API
- Loop through vals and extract file information
- Filter files to find HTTP endpoints (any file with endpoint URL)
- Caching system using Val Town Blob Storage
- Automated cache updates via cron job
- Beautiful web interface to browse endpoints
- Manual cache refresh capability
- Cache metadata tracking (last updated, performance metrics)
vals.tsx
- ExportsfetchVals()
function to get list of all valsval-files.tsx
- ExportsfetchValFiles()
function to get files for a specific valvals-all-files.tsx
- Combines both functions to get all vals with their HTTP endpoints
cache-manager.ts
- Blob storage interface for caching vals data with metadatacache-updater.ts
- Cron job that automatically refreshes the cachesimple-index.tsx
- Main web interface displaying cached endpoint data
test-cache.tsx
- Manual cache population for testingtest-api.tsx
- API testing endpoints
Visit the main endpoint to see all your HTTP endpoints in a beautiful interface:
- Shows total vals count, endpoint count, and last update time
- Lists all vals with their HTTP endpoints
- Direct links to each endpoint
- Responsive design with Tailwind CSS
The cache automatically updates via cron job, but you can also:
- Manual refresh: Use the test-cache endpoint to populate cache immediately
- Cache info: Check cache metadata and freshness status
- Live data: Bypass cache to get real-time data (slower)
/
- Main web interface (cached data)test-cache.tsx
- Manually refresh cachetest-api.tsx/cache-info
- Get cache metadatatest-api.tsx/cached
- Get cached data as JSON
- Cache hit: ~200-500ms response time
- Live data: ~2-5s response time (hits Val Town API)
- Cache update: Runs automatically via cron, ~500ms update time
- Storage: Uses Val Town Blob Storage (efficient key-value storage)
The cron job schedule can be configured in the Val Town web UI. The cache is considered "fresh" for 1 hour by default, but will display data regardless of age.
Cache keys:
vals_with_files_cache
- Main datavals_with_files_cache_metadata
- Update timestamps and metrics
HTTP
- old-get_vals_endpoints.tsxchadparker--3a…9e.web.val.run
- old-scan-vals.tsxchadparker--c3…13.web.val.run
- read-vals.tsxchadparker--12…13.web.val.run
- listFiles-endpoints-adapting.tsxchadparker--04…13.web.val.run
- index.tsxchadparker--16da92e8402011f08f8576b3cceeab13.web.val.run
- val-files.tsxchadparker--59d8d7dc589211f0ada9f69ea79377d9.web.val.run
- vals-all-files.tsxchadparker--9b9a719c589411f0bc7df69ea79377d9.web.val.run
- vals.tsxchadparker--f1e75a00589011f0a2b3f69ea79377d9.web.val.run
Cron