Giter VIP home page Giter VIP logo

flight / currency-converter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.11 MB

Simple React app for converting currencies and showing the charts for the historical rates.

Home Page: https://flight.github.io/currency-converter/

JavaScript 7.33% Shell 0.13% HTML 0.79% TypeScript 90.84% CSS 0.90%
c8 daisyui eslint husky prettier react react-testing-library recharts storybook tailwindcss typescript vite vitest

currency-converter's Introduction

Currency Converter

Live url: https://flight.github.io/currency-converter/

React + Typescript + Tailwind CSS + daisyUI + Recharts + Storybook + Vite + ESLint + Prettier + Husky + Vitest + jest-dom (React Testing Library) + c8 + Cypress

Currency Converter

Initial setup:

  1. Install the node.js https://nodejs.org/en/download/

  2. Install the latest version of pnpm package manager npm install -g pnpm or brew install pnpm

  3. Install the dependencies pnpm install

  4. Create .env.local file in the project root folder with your API key for https://exchangeratesapi.io/ (Free 250 Monthly Requests) VITE_API_KEY=YOUR_KEY

Running

pnpm start

Storybook

The solution uses Storybook as the components style guide.

Currency Converter

To run the preview: pnpm storybook

To build the production Storybook setup: pnpm build-storybook

To run the preview server with the production Storybook build: pnpm preview-storybook

Production build

pnpm build

To run the preview server with the production build:

pnpm preview

Testing

Live mode pnpm test

Coverage check pnpm coverage

E2E tests pnpm e2e or pnpm e2e:silent to run in silent mode (on CI, for example)

Pre-commit checks pnpm pre-commit

Design decisions

Good sides of the implementation

  • The API request responses are cached in the local storage
  • The dummy components and the business logic are completely separated, so the solution is can use Storybook pnpm storybook
  • The design is mobile-first, so can be used on any type of the devices
  • The building takes a few seconds
  • The unit-tests run takes 2-3 seconds
  • The E2E tests run takes a few seconds together with production build creation and serving

Next steps

  • Create BE server to store the API key, not to expose it to the internet and cache the fetched data. Firebase functions or AWS lambda should be enough.
  • Save each exhange rate by date and load only the new one the next day.
  • Improve the error handling and connect the TrackJS or Sentry IO
  • Set up CI / CD process. For example, using (GitHub Actions)[https://github.com/features/actions] or Gitlab CI/CD
  • Use some free API, buy more requests or implement auth to limit the number of users using the paid one

currency-converter's People

Contributors

flight avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.