Skip to content

natepappenhagen/node-redis-currency-exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cache-it

Stack:

  • backend api is built is NodeJS
    • caching on the back end is done with redis
  • front end client is built with ReactJS
    • caching on the front end is done with react-query
  • docker & docker-compose stitch all the builds and run all apps in unison.

Run all services ( recommended )

  • make sure docker is installed on your machine
docker-compose up
  • if any changes are made to the files, be sure to run docker-compose build to rebuild the project.

This will :

  • 🚀 launch a redis instance on port 6379
  • 🚀 launch the API server.js on port 5000
  • 🚀 launch the ui react app on port 3000

Launch api, redis, and ui projects independently

  • Maybe you don't want to use docker-compose.
    • must run each service independently on localhost.
redis
docker run -d --name redis-cache -p 127.0.0.1:6379:6379 redis
nodejs api ( from the ./api folder root
npm i && npm run start
reactjs client ui ( from the ./ui folder root
npm i && npm run start
Next steps () => {}

front end:

  • remove extra dependencies and leverage the Intl.numberFormat that vanilla JS has.
  • use the userLocale to shape the resulting currencies in formats that make sense for the users locale.
  • add translation files for text to make evoloving into other languages simple.
  • add commas to the output text fields.
  • add 'reset' button.
  • add tests
  • consider replacing the two useEffects with an Observable stream that could reduce unintended side effects from the useEffects.
  • package up the front end into a standalone component that could be imported and consumed.

back end:

  • package up the back end and deploy on AWS lambda for easy consumption.
  • have fallback API providers in case the existing provider doesn't give us what we want
  • actually develop models/types for the back end so that we can service a uniform shape to return that is agnostic of the provider and easy to evolve over time.

About

Created with StackBlitz ⚡️

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published