An API for Evergreen built on Javascript and Cloudflare Workers with hybrid caching implementation.
- Hybrid Caching System: 2-tier caching (Memory + KV) with 12-hour TTL
- Performance Optimized: Reduces KV reads to stay within free tier limits
- Comprehensive Testing: Automated validation of API functionality and caching
- Security Focused: Regular security audits and dependency updates
- Production Ready: Robust error handling and monitoring
- Public endpoints do not require authentication.
- Every request must include a custom
User-Agentheader such asYourCompany/LocationorMyOrg/CloudOps. - Requests without a valid
User-Agentreturn a400JSON error response. - The
/healthendpoint includes additional diagnostics for cache and KV status.
- Memory Cache (Tier 1): Instant access for frequently requested data
- KV Storage (Tier 2): Persistent storage with automatic memory promotion
- 12-Hour TTL: Optimal balance between freshness and performance
- Cache hit/miss tracking via
X-Cache-Statusheaders - Performance metrics and response time monitoring
- Automated health checks and diagnostics
The dashboard groups reports into Traffic, Audience, and Potential abuse views. Horizontal tabs show one report at a time and retain each view's selected report when switching views. On narrow screens, the report tabs scroll horizontally.
Use Left/Right Arrow, Home, and End to navigate tabs. Filtering, the low-volume row toggle, sorting, and CSV export remain available for table reports; the daily traffic chart is independent of filtering.
The User agents and Client families tables combine user agents matching sc<hex>/Sweden
(one or more hexadecimal digits) into a single sc*/Sweden entry. Request counts are summed,
and the Client families Variants column retains the number of distinct original user agents.
Other client families still group by the name before the first /. Detailed high-volume
request windows retain their original user agents.
| Endpoint | Description | Cache TTL |
|---|---|---|
/apps |
List all supported applications | 12 hours |
/app/{appId} |
Get specific application details | 12 hours |
/endpoints/versions |
Version check endpoints | 12 hours |
/endpoints/downloads |
Download endpoints | 12 hours |
/health |
System health and diagnostics | No cache |
- Pull Request Validation: Automatic testing on PR creation
- Multi-Environment: Tests against both production and development APIs
- Performance Testing: Cache behavior and response time validation
- Security Scanning: Dependency audits and vulnerability checks
# Run test suite
cd tests
npm install
npm test
# Test caching behavior
./test-caching-simple.sh- Regular dependency audits
- API security validation
- Input sanitization and validation
- Rate limiting awareness
- License compliance checking
- Memory Cache Hit: ~1ms response time
- KV Cache Miss: ~50-100ms response time
- Cache Efficiency: 90%+ hit rate for popular endpoints
- KV Read Reduction: 95% reduction in KV operations
# Check cache status
curl -H "User-Agent: YourApp/1.0.0" https://evergreen-api.stealthpuppy.com/health
# Monitor cache headers
curl -I -H "User-Agent: YourApp/1.0.0" https://evergreen-api.stealthpuppy.com/apps# Install dependencies
npm install
# Start development server
wrangler dev
# Run tests
cd tests && npm testRun these commands from the src directory, where wrangler.toml lives.
# Deploy to staging (https://evergreen-api-staging.stealthpuppy.workers.dev)
npm run deploy:staging
# Deploy to production
npm run deploy:productionThe staging environment deploys to the evergreen-api-staging worker. It reads from the same EVERGREEN KV namespace as production, so it serves the same data. Request logs and analytics go to a separate R2 bucket (evergreen-api-staging) and Analytics Engine dataset (evergreen_requests_staging).
# Deploy and tail staging logs
cd src
npm run deploy:staging
npm run tail:staging
# Run the API tests against staging
cd ../tests
API_TEST_USERAGENT="<user agent>" npm run test:stagingPushing to the staging branch also deploys to staging and runs the API tests through the Deploy to Staging workflow. Once staging passes, merge to main and deploy to production.
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit pull request
- Automated workflows will validate your changes
- Include tests for new features
- Maintain API compatibility
- Update documentation as needed
- Follow security best practices
- Node.js 18+ for development
- Cloudflare Workers account
- KV namespace:
EVERGREEN - R2 bucket:
evergreen-api(for logging)
ENVIRONMENT: deployment environment (production/staging/dev), reported by/health
EVERGREEN: KV namespace for application dataLOGS_BUCKET: R2 bucket for request logging
- GitHub Actions for CI/CD pipeline
- Automated security scanning
- Performance regression detection
- Dependency update notifications