feat: add Valkey caching layer with New Relic monitoring and structur… #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive caching with Valkey/Redis cluster, New Relic APM integration, standardized structured logging,
and configurable rate limiting across all endpoints.
Key Changes
🚀 Valkey/Redis Cluster Caching
src/lib/cache.ts,src/lib/cache-keys.ts)Performance: Folder queries reduced from ~150ms → <5ms (30x faster)
📊 New Relic APM Integration
src/lib/logger.ts)console.log/errorwith structured loggerMetrics:
Custom/HTTP/ResponseTime,Custom/HTTP/Status/*,Custom/Cache/{Hit,Miss}🛡️ Configurable Rate Limiting
Made all rate limits configurable via environment variables:
HTTP_RATE_LIMIT_WINDOW_MS(15min),HTTP_RATE_LIMIT_MAX_REQUESTS(1000)HTTP_FILE_RATE_LIMIT_MAX(100)CODE_EXEC_RATE_LIMIT_MAX(50 prod / 100 dev)All configurations logged on startup for visibility.
🔒 Security & Quality
CORS_ORIGINSconfigurationwarnlevel in dev,infoin productionNew Environment Variables
Caching (optional)
VALKEY_HOST=your-cluster.serverless.use1.cache.amazonaws.com
VALKEY_PORT=6379
Monitoring (optional)
NEW_RELIC_LICENSE_KEY=your_license_key
NEW_RELIC_LOG_LEVEL=warn # error, warn, info, debug, trace
HTTP Rate Limiting (optional - has defaults)
HTTP_RATE_LIMIT_WINDOW_MS=900000
HTTP_RATE_LIMIT_MAX_REQUESTS=1000
HTTP_FILE_RATE_LIMIT_MAX=100
Code Execution Rate Limiting (optional - has defaults)
CODE_EXEC_RATE_LIMIT_MAX=50