This is a simple currency conversion application that allows users to convert between different currencies. You can find a live demo of the application here.
The application uses the ExchangeRate-API to get the latest exchange rates.
While this application could be built with simpler technologies, it has been intentionally designed with a more sophisticated tech stack to demonstrate the capabilities of a larger web application.
Vite
as the build toolNode
, make sure you have the correct Node version. This application uses Node version 20.18.0. You can usenvm
to manage your Node versions. After you have the correct node version, you can runnvm use 20.18.0
to use the correct version.React
for the frontendTypeScript
for static type checkingMaterial-UI
, a popular React component library to take advantage of the pre-built componentsTailwindCSS
, a utility-first CSS framework to style the applicationPostCSS
, a tool for transforming CSS with JavaScript plugins
A working version of the app can be found on the link mentioned in the introduction section. If nevertheless you would like to install it in your local machine please follow the next steps.
- Clone the repository
- Run
npm install
to install the dependencies - Create your own API key from https://currencybeacon.com and use it to replace the
VITE_SECRET_CURRENCY_BEACON_API_KEY
in the.env
file - Run
npm start
to start the application
While the application is functional, there are several enhancements that can be made to improve it further. These improvements are beyond the scope of this technology demonstrator, but you are encouraged to explore and implement them on your own.
- At the moment the app uses dotenv for communicating the value of the
.env
file to the react app. This is not secure as the API key is exposed to the client and should not be used in a production environment. You can improve this by adding a simple BFF (Backend for Frontend) to handle the API requests. In this way, the API key will not exposed to the client. - Currently it is possible you can format wrongly the amounts and make an invalid request to the API. It would also be nice to adjust the presicion(amount of decimal points). For both of these can be fixed by using the powerful and nowdays widely supported browser's built in Intl API. No need for any fancy external libraries nor any need to use the api.currencybeacon api for this. You can read more about it in the MDN docs here
- We should debounce the fetch requests so we don't spam the API.
- We can improve the UI by adding loading states
- We can add a toaster notification in case of an error to inform the user when something is wrong.
- We can add to the select dropdowns a search functionality to make it easier for the user to find the currency they are looking for.
- In a production application we should have alerts(i.e Sentry) and monitoring(i.e prometheus) in place to monitor the application and be aware of any issues that might arise.
- Increase the coverage of tests and why not introduce integration tests with Playwright/Cypress.
- 🚀 Sky is the limit! 🚀