Skip to main contentRates API Open Source
Rates API is an open source project that provides up-to-date lending rates from New Zealand financial institutions. The entire codebase is available on GitHub at github.com/simonbetton/ratesapi.nz, allowing anyone to contribute, customize, or deploy their own instance.
Why Open Source?
We believe in the power of open source to:
- Promote Transparency: Open code means anyone can see how the data is collected and processed
- Encourage Collaboration: Developers can contribute improvements and new features
- Ensure Longevity: The project isn’t dependent on a single maintainer
- Enable Customization: Fork the project to create specialized versions for specific needs
- Support Education: Serve as a learning resource for developers interested in financial data or Cloudflare Workers
Technology Stack
Rates API is built with modern web technologies:
- Bun: A fast JavaScript runtime and package manager
- Hono: A lightweight, fast web framework
- Cloudflare Workers: Serverless JavaScript runtime on Cloudflare CDN
- Cloudflare D1: Serverless SQL database for data storage
- TypeScript: For type-safe development
- Zod: TypeScript-first schema validation
- OpenAPI/Swagger: API documentation generation
- Cheerio: HTML parsing for web scraping
- GitHub Actions: For monitoring and automation
This stack ensures high performance, global distribution, and excellent developer experience with reliable data persistence.
Repository Structure
The project follows a clean and maintainable structure:
-
src/: Main application code
index.ts
: Entry point with Hono application setup
models/
: Schema definitions for API data types
routes/
: API endpoint implementations
lib/
: Utility functions and helpers
-
bin/: Scraper scripts to collect rates data
- Separate scripts for mortgage, personal loan, car loan, and credit card rates
-
schema.sql: CloudFlare D1 database schema definition
Getting Started
To get started with the project:
- Visit the GitHub repository
- Follow the setup instructions in the Local Development guide
- Check out the Deployment guide to deploy your own instance