Currency Api Dashboard

TypeScript

Modern currency exchange rate dashboard with real-time market data, conversion tools, analytics, historical trends, and responsive admin interface.

Stars
18
Forks
1
Downloads
N/A
Open Issues
0
Files main

Repository Files

Loading file structure...
README.md
<p align="center">
  <img src="https://res.cloudinary.com/djgvfl1tv/image/upload/v1780666791/logo_mqnqn4.png" alt="Ghost Compiler" width="180">
</p>

<h1 align="center">Currency API Dashboard</h1>

<p align="center">
  A premium, high-performance developer currency exchange rate platform built on Laravel 13, React 19, and Redis.
</p>

<p align="center">
  <img src="https://img.shields.io/badge/Laravel-13-FF2D20?style=for-the-badge&logo=laravel&logoColor=white" alt="Laravel">
  <img src="https://img.shields.io/badge/PHP-8.3+-777BB4?style=for-the-badge&logo=php&logoColor=white" alt="PHP">
  <img src="https://img.shields.io/badge/React-19-61DAFB?style=for-the-badge&logo=react&logoColor=black" alt="React">
  <img src="https://img.shields.io/badge/Inertia.js-Frontend-9333EA?style=for-the-badge" alt="Inertia.js">
  <img src="https://img.shields.io/badge/SSH-Public%20Keys-0EA5E9?style=for-the-badge" alt="SSH">
  <img src="https://img.shields.io/badge/Built%20By-Ghost%20Compiler-0F172A?style=for-the-badge" alt="Ghost Compiler">
</p>

---

## 🌐 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
```bash
composer install
npm install
```

### 3. Environment Setup
Copy `.env.example` to `.env` and configure your database and Redis connections:
```env
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](https://openexchangerates.org/signup).

### 4. Database Migrations
```bash
php artisan migrate
```

### 5. Generate Route Definitions
Ensure Wayfinder compiles route types:
```bash
npm run build
```

### 6. Run Sync Command
Sync currencies and rates from providers:
```bash
php artisan app:sync-currencies
```

### 7. Run Server
Start the concurrent servers (Laravel development server + Vite dev watcher):
```bash
npm run dev
```

---

## 🧪 Testing and Formatting
To verify the features remain stable, execute feature assertions:
```bash
php artisan test --compact
```

Format modified PHP files before committing:
```bash
vendor/bin/pint --dirty --format agent
```

---

## ⚙️ Repository Details
*   **URL**: [git@github.com:ghostcompiler/currency-api-dashboard.git](git@github.com:ghostcompiler/currency-api-dashboard.git)



## Development Environment

Built using **ServBay**

<p align="left">
  <img src="https://res.cloudinary.com/djgvfl1tv/image/upload/v1780667063/servbay_edc7jz.png" alt="ServBay" width="120">
</p>

- Mac M4 Tested
- macOS Apple Silicon
- Powered by ServBay

---