Open Source
Open Source
Understand the Rates API repository structure, runtime architecture, and contribution paths.
Rates API is an open source Cloudflare Workers project. The repository contains the public API Worker, the Fumadocs documentation app, scraper scripts, tests, and GitHub Actions automation.
Architecture at a Glance
| Area | Purpose |
|---|---|
| API Worker | Serves /api/v1/*, /openapi, and /openapi/json |
| Docs Worker | Serves the Fumadocs site at ratesapi.nz |
| Cloudflare D1 | Stores latest datasets and historical snapshots |
| Scraper scripts | Collect rates from public institution pages |
| GitHub Actions | Runs checks, dry-run deploys, scraping, deploys, and uptime monitoring |
Technology Stack
| Layer | Tooling |
|---|---|
| Runtime | Bun and Cloudflare Workers |
| API routing | Elysia |
| Schemas | Elysia t and TypeBox-compatible runtime validation |
| API docs | Elysia OpenAPI plugin with Scalar |
| Docs site | Next.js, Fumadocs UI, and Fumadocs MDX |
| Data storage | Cloudflare D1 |
| Scraping | Cheerio |
| Code quality | Biome, TypeScript, Fallow, and Bun tests |
Repository Structure
| Path | Contents |
|---|---|
apps/api/src/ | API Worker application code |
apps/api/src/routes/ | Elysia route groups |
apps/api/src/models/ | Runtime schemas and exported TypeScript types |
apps/api/src/lib/ | Shared API helpers |
apps/api/bin/ | Scraper, D1, and uptime scripts |
apps/docs/app/ | Next.js App Router routes for the docs site |
apps/docs/content/docs/ | Filesystem MDX documentation |
test/ | API and docs content tests |
.github/workflows/ | CI, deploy, scraping, monitoring, and Fallow workflows |
Contribution Paths
- API changes: update route handlers, schemas, contract tests, and endpoint docs together.
- Scraper changes: update scraper normalization, validation, and D1 write behavior together.
- Docs changes: edit MDX files under
apps/docs/content/docsand run the docs source generation. - Deployment changes: update Worker config and the dry-run deploy CI path together.
Start with Local Development, then read Deployment if you need to operate your own instance.