How fawazahmed0/exchange-api works
Main Components
a) Data Collection Layer:
• A scheduled GitHub Actions workflow component (from .github/workflows/run.yml)
• Data source connections for currency rates updates
• To cryptocurrency and traditional currency data sources
b) Data Processing Layer:
• Node.js processing scripts (currscript.js, semver-date.js)
• Data transformation and merging processes
• Demonstrate cache management (other/cache-jsdelivr-api.js)
c) Distribution Layer:
• Primary CDN: JSDelivr
• Fallback CDN: Cloudflare Pages
• API versioning structure (v1)
d) Data Storage:
• JSON files storage (currencies.json, cryptocurrencies.json)
• Relationship with npm package registry
Flow Representation
[GitHub Actions Workflow] → [Data Collection] → [Data Processing] → [JSON Generation]
• ↓
[End Users] ← [CDN Layer (JSDelivr/Cloudflare)] ← [npm Package Registry]
Important Elements to Highlight
a) API Structure:
• URL pattern: cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@{date}/{apiVersion}/{endpoint}
• Fallback URL pattern: {date}.currency-api.pages.dev/{apiVersion}/{endpoint}
b) Data Flow:
• Daily update process
• Data transformation pipeline
• CDN distribution mechanism
Additional Details
Annotations for:
• Supported currency types (200+ currencies, cryptocurrencies, metals)
• Response formats (.json and .min.json)
• Update frequency (daily)
• No rate limits
• Fallback mechanism
Technical Specifications
Integration points for:
• GitHub Actions automation
• npm package deployment
• CDN distribution
• JSON data storage