This directory contains Firebase Cloud Functions for the Nexus CLI project.
A simple caching proxy that respects the Cache-Control headers from the origin.
- URL:
https://us-central1-nexus-cli.cloudfunctions.net/version - Behavior: Caches responses based on origin's max-age, serves JSON data only
- Cache Status: Adds
X-Cacheheader (HIT/MISS/STALE) for debugging - Fallback: Serves stale cached data if origin is unavailable
cd functions
npm installnpm run servenpm run buildnpm run deployThe CLI uses the following fallback hierarchy for fetching version.json:
- Primary:
https://cli.nexus.xyz/version.json(Firebase Hosting) - Cache:
https://us-central1-nexus-cli.cloudfunctions.net/version(Cloud Function) - Fallback:
https://raw.githubusercontent.com/nexus-xyz/nexus-cli/refs/heads/main/public/version.json(GitHub)
This setup helps avoid rate limiting issues while keeping hosting costs low.