A robust API for converting between different types of currencies, including fiat currencies, cryptocurrencies, and fictional currencies.
- 💱 Conversion between multiple currencies
- 🏦 Support for fiat currencies
- 💰 Support for cryptocurrencies
- 🎲 Support for fictional currencies
- 🔄 Automatic exchange rate updates
- Node.js (version 18+ recommended)
- Yarn package manager
- Clone the repository
git clone https://github.com/tcelestino/currency-converter-api.git
cd currency-converter-api
- Configure Environment
- Rename
.env.example
to.env
- Update configuration as needed
Build the Docker image:
docker build -t currency-converter-api:latest .
Run the container:
docker run -p 3000:3000 currency-converter-api
Install dependencies and start:
yarn && yarn build && yarn start
# Using Docker
docker-compose up -d
# Local development
yarn && yarn dev
GET /currency-convert/v1/convert
- Convert values between currencies
Parameters:
from
: Source currency code (e.g., USD)to
: Target currency code (e.g., BRL)amount
: Value to be converted
Example Request:
GET /currency-convert/v1/convert?from=USD&to=BRL&amount=100
GET /currency-convert/v1/currencies
- Retrieve all available currencies
POST /currency-convert/v1/currencies
- Add a new currency to the system
Request Body:
{
"code": "GOLD2",
"name": "D&D Gold Piece",
"type": "fictional",
"rate": 0.25
}
DELETE /currency-convert/v1/currencies/:code
- Remove an existing currency from the system
Comprehensive API documentation is available at:
http://localhost:3000/documentation
Run test suite:
yarn test
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
MIT
- Node.js
- TypeScript
- Fastify
- Docker
- Jest
Exchange rates are for informational purposes and may not reflect real-time market values. Always verify rates from official sources for critical transactions.