Skip to content

ghostcompiler/currency-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ghostcompiler-api logo

ghostcompiler-api

A premium, high-performance developer currency exchange rate platform built on Laravel 13, React 19, and Redis.


🌐 Overview

ghostcompiler-api is a complete developer API and dashboard solution modeled after Open Exchange Rates. The application pulls and processes daily international currency values for over 150 countries, optimizes performance using high-speed Redis database caching, logs query analytics, and exports developer API credentials.

Key Features

  • Secure API Tokens: Full CRUD token lifecycle manager inside the developer panel. Custom base fallback currencies (defaults to INR system-wide).
  • Daily Sync Engine: Automated daily command retrieves live values and updates local metadata (currencies, countries, names, rates).
  • Redis Caching: Cached endpoint metrics reduce database queries and ensure sub-10ms response times.
  • Sleek Developer Landing Page: Beautiful dark mode interface complete with Framer Motion animations, live guest conversion widgets, and code sample highlights.
  • Scalar Reference Docs: Interactive API documentation served at /docs with Scalar's modern dark theme UI, complete with Bearer Try-it-out options.

🛠️ Technology Stack

  • Framework: Laravel 13.x (PHP 8.5)
  • Client: React 19.x (InertiaJS v3)
  • Styling: TailwindCSS v4 with Shadcn theme variables
  • Cache: Redis (via predis driver)
  • Database: PostgreSQL
  • Docs UI: Scalar UI via CDN + /public/openapi.json
  • Test Suite: Pest PHP

📂 API Reference Endpoints

All API endpoints are prefixed with /api/v1 and require your token provided inside the header: Authorization: Bearer <your_token>.

1. Authorize / Validate Token

  • Route: GET /api/v1/authorize
  • Description: Validates that a key is active and returns metadata.

2. Get Rates by Token Default Currency

  • Route: GET /api/v1
  • Description: Returns active exchange rates relative to the token's configured base currency (falls back to INR).

3. Get Rates by Custom Base

  • Route: GET /api/v1/{code}
  • Description: Returns active exchange rates relative to the {code} base currency.

4. Convert Currency

  • Route: POST /api/v1/{from}/{to}
  • Request Body: {"amount": 100}
  • Description: Converts a specific amount from {from} to {to}.

🚀 Getting Started

1. Requirements

Ensure you have PHP 8.5+, Composer, Node.js 18+, Redis, and PostgreSQL running on your machine.

2. Install Dependencies

composer install
npm install

3. Environment Setup

Copy .env.example to .env and configure your database and Redis connections:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=currency_db
DB_USERNAME=postgres
DB_PASSWORD=secret

REDIS_CLIENT=predis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379

Tip

To sync live exchange rates, you must configure your Open Exchange Rates app credentials. You can register and generate an API access token by visiting Open Exchange Rates Signup & Key Generator.

4. Database Migrations

php artisan migrate

5. Generate Route Definitions

Ensure Wayfinder compiles route types:

npm run build

6. Run Sync Command

Sync currencies and rates from providers:

php artisan app:sync-currencies

7. Run Server

Start the concurrent servers (Laravel development server + Vite dev watcher):

npm run dev

🧪 Testing and Formatting

To verify the features remain stable, execute feature assertions:

php artisan test --compact

Format modified PHP files before committing:

vendor/bin/pint --dirty --format agent

⚙️ Repository Details

  • URL: git@github.com:ghostcompiler/currency-api.git

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors