A simple command-line currency converter built with Go. Convert between different currencies using real-time exchange rates.
- Interactive terminal UI with dropdown menus
- Real-time exchange rates from OpenExchangeRates API
- Support for 9 major currencies including Nigerian Naira
- Input validation to prevent errors
- Multiple conversions in one session
- Clean, formatted output with exchange rate details
- USD (US Dollar)
- EUR (Euro)
- GBP (British Pound)
- JPY (Japanese Yen)
- CAD (Canadian Dollar)
- AUD (Australian Dollar)
- CHF (Swiss Franc)
- CNY (Chinese Yuan)
- NGN (Nigerian Naira)
- Go 1.19 or higher
- OpenExchangeRates API key (free tier available)
- Clone this repository:
git clone <your-repo-url>
cd currency-converter- Install dependencies:
go mod tidy- Create a
.envfile in the project root:
KEY=your_openexchangerates_api_key_here
- Get your free API key from OpenExchangeRates
Run the program:
go run main.goThe app will guide you through:
- Selecting source currency
- Selecting target currency
- Entering amount to convert
- Viewing the conversion result
- Option to do another conversion
Convert from: US Dollar
Convert to: Nigerian Naira
Amount: 100
100.00 USD = 164750.00 NGN
Exchange rate: 1 USD = 1647.5000 NGN
Do you want to perform another conversion? Yes
The app handles common errors like:
- Missing or invalid API key
- Network connectivity issues
- Invalid number input
- Same currency conversions
- Unsupported currencies