FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
chadparker
chadparkercp-root
Public
Like
cp-root
Home
Code
12
.townie
1
legacy
3
snippets
1
CACHING_SETUP.md
README.md
cache-manager.ts
C
cache-updater.ts
index-townie-cached.tsx
H
index.tsx
H
val-files.tsx
H
vals-all-files.tsx
H
vals.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
1
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.
Sign up now
Code
/
Code
/
Search
https://chadparker--16da92e8402011f08f8576b3cceeab13.web.val.run
README.md

cp-root - Val Town HTTP Endpoints Directory

A caching system to efficiently display all your Val Town HTTP endpoints in a beautiful web interface.

✅ Completed Features

  • 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)

🏗️ Architecture

Core Data Pipeline

  • vals.tsx - Exports fetchVals() function to get list of all vals
  • val-files.tsx - Exports fetchValFiles() function to get files for a specific val
  • vals-all-files.tsx - Combines both functions to get all vals with their HTTP endpoints

Caching Layer

  • cache-manager.ts - Blob storage interface for caching vals data with metadata
  • cache-updater.ts - Cron job that automatically refreshes the cache
  • simple-index.tsx - Main web interface displaying cached endpoint data

Testing & Utilities

  • test-cache.tsx - Manual cache population for testing
  • test-api.tsx - API testing endpoints

🚀 Usage

Main Interface

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

Cache Management

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)

API Endpoints

  • / - Main web interface (cached data)
  • test-cache.tsx - Manually refresh cache
  • test-api.tsx/cache-info - Get cache metadata
  • test-api.tsx/cached - Get cached data as JSON

📊 Performance

  • 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)

🔧 Configuration

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 data
  • vals_with_files_cache_metadata - Update timestamps and metrics
HTTP
  • old-get_vals_endpoints.tsx
    chadparker--3a…9e.web.val.run
  • old-scan-vals.tsx
    chadparker--c3…13.web.val.run
  • read-vals.tsx
    chadparker--12…13.web.val.run
  • listFiles-endpoints-adapting.tsx
    chadparker--04…13.web.val.run
  • index.tsx
    chadparker--16da92e8402011f08f8576b3cceeab13.web.val.run
  • val-files.tsx
    chadparker--59d8d7dc589211f0ada9f69ea79377d9.web.val.run
  • vals-all-files.tsx
    chadparker--9b9a719c589411f0bc7df69ea79377d9.web.val.run
  • vals.tsx
    chadparker--f1e75a00589011f0a2b3f69ea79377d9.web.val.run
Cron
  • cache-updater.ts
Code
.townielegacysnippetsCACHING_SETUP.mdREADME.mdcache-manager.ts
C
cache-updater.ts
index-townie-cached.tsx
H
index.tsx
H
val-files.tsx
H
vals-all-files.tsx
H
vals.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.