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 milliseconds.
Viewing readonly version of main branch: v302View latest version
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
cp-root.tsx- Main web interface endpointindex.tsx- Alternative web interfaceindex-townie-cached.tsx- Cached version of web interfacevals-with-files.tsx- HTTP endpoint showing all vals with filesvals.tsx- HTTP endpoint for listing valsval-files.tsx- HTTP endpoint for listing files in a val
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 the cache-updater.ts cron job.
cp-root.tsx- Main web interface (https://cp-root.val.run/)index.tsx- Alternative web interfacevals-with-files.tsx- All vals with HTTP endpoints (https://chad-vals-all-files.val.run/)vals.tsx- List of all vals (https://chad-vals-list.val.run/)val-files.tsx- Files for a specific val (https://chad-val-files.val.run/)
- 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