🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

github.com/MussaShaukenov/currency-parser

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/MussaShaukenov/currency-parser

Source
Go Modules
Version
v0.0.0-20250407184835-b4cb8b254881
Version published
Created
Source

Currency Exchange Service

This project implements a Currency Exchange Service that allows users to view and manage currency exchange rates. The service is built using Gin for routing and GORM for interacting with the PostgreSQL database. The service also includes a rate limiter middleware, which limits the number of requests a user can make in a given time frame, and it updates the exchange rates from an external API every hour.

Features

  • CRUD Operations: The service supports CRUD operations to manage the exchange rates.

    • Create: Add new currency exchange data.
    • Read: Retrieve the exchange rate for a specific currency.
    • Update: Update existing exchange rates.
    • Delete: Remove exchange rates.
  • External API Integration: We use the CurrencyAPI to fetch the latest exchange rates every hour.

  • Rate Limiter Middleware: The service implements a rate-limiting feature, configurable through a configuration file. If the rate limit is exceeded, the service returns a 429 Too Many Requests status.

  • Swagger Documentation: Swagger is integrated into the project to provide interactive API documentation.

  • Tests: Automated tests for rate limiter functionality to ensure proper behavior under different conditions.

  • Insomnia Collection: An Insomnia YAML collection is included with the project that provides predefined requests to test the various endpoints of the API.

Setup

Prerequisites

  • Go (v1.18 or later)
  • PostgreSQL
  • An API key for CurrencyAPI

1. Clone the Repository

  git clone https://github.com/MussaShaukenov/currency-parser.git
  cd currency-parser

2. Create a PostgreSQL Database

Create a PostgreSQL database for the application. You can do this using the following command:

  psql -U postgres -c "CREATE DATABASE currency_db;"

3. Update Configuration

Update the config.yaml file with your PostgreSQL database credentials and CurrencyAPI key. The file should look like this:

rate_limiter:
  requests_per_minute: 10

4. Create .env file

Create a .env file in the root directory of the project and add your PostgreSQL connection string and CurrencyAPI key:

DB_HOST=your_db_host
DB_PORT=your_db_port
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=currency_db

CURRENCY_API_KEY=your_currency_api_key

5. Run application

To run the application, use the following command:

  go run cmd/server/main.go

FAQs

Package last updated on 07 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts