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

chadparker

cp-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
H
index.tsx
new-file-8806.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 milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
7/6/2025
Viewing readonly version of main branch: v267
View latest version
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
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.