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
- 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
| 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 test# Deploy to staging
wrangler deploy --env staging
# Deploy to production
wrangler deploy --env 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)
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