Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💱 Currency Flow

Java Maven API Architecture

A simple and clean console-based currency converter built in Java, using real-time exchange rates provided by the ExchangeRate API.

This project was designed with a backend-oriented mindset, following industry best practices such as clean architecture, separation of concerns, external API integration, and secure configuration management.


🚀 Features

  • Convert between any two supported currencies
  • Uses ISO 4217 currency codes (3-letter standard: USD, BRL, EUR, etc.)
  • Real-time exchange rates via external API
  • Interactive console menu
  • API key securely externalized using environment variables (.env)

🧱 Project Architecture

The application follows a layered backend architecture, commonly used in Java enterprise applications:

dev.leo.currencyflow
 ├── client       # HTTP client responsible for external API communication
 ├── dto          # Data Transfer Objects (API response mapping)
 ├── service      # Business logic and currency conversion rules
 ├── controller   # Console-based input/output handling
 ├── exception    # Custom exception classes
 └── Main.java    # Application entry point

This structure improves:

  • Maintainability
  • Testability
  • Readability
  • Separation of responsibilities

🛠️ Technologies Used

  • Java 17+ — Core language
  • Maven — Dependency and build management
  • OkHttp — HTTP client for external API calls
  • Jackson — JSON serialization/deserialization
  • ExchangeRate API — Real-time currency exchange data
  • java-dotenv — Environment variable management

🔐 API Key Configuration

For security reasons, the API key is not hardcoded.

1️⃣ Create a .env file in the project root:

EXCHANGE_API_KEY=YOUR_API_KEY_HERE

2️⃣ Make sure .env is ignored by Git:

.env

3️⃣ Get your API key from:

  • ExchangeRate API website

▶️ How to Run

Prerequisites

  • Java 17+ (recommended)
  • Maven

Steps

Run the Main class from your IDE.


🖥️ Console Usage Example

━━━━━ Currency Converter ━━━━━

1 - Convert from USD ($) to another currency
2 - Convert another currency to USD ($)
3 - Convert from EUR (€) to another currency
4 - Convert another currency to EUR (€)
5 - Convert from GBP (£) to another currency
6 - Convert another currency to GBP (£)
7 - Convert between any currencies
0 - Exit

The user is prompted to enter:

  • Source currency
  • Target currency
  • Amount

The converted value is displayed immediately.


📄 License

This project is licensed under the MIT License.


👤 Author

Developed by Leonardo. Feel free to explore, fork, and improve this project 🚀

About

Java console currency converter using real-time exchange rates, clean layered architecture, and strict ISO 4217 currency code validation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages