DEV Community

GoldAPI.io - How to build Gold & Silver Prices REST API and Dashboard using Node.js + React in 5 days

Alex 👨🏼‍💻FullStack.Cafe on May 28, 2020

Hi guys, I was away from DEV.TO for a long time growing FullStack.Cafe but recently decided to take a break and work a bit on a new product to avo...
Collapse
 
jakesweb profile image
Jacob Colborn

Do you store the historical gold prices in Mongo or do you pull those on request? I would think that would be a good bit of data to store but would provide better performance if you did not have to reach out every time someone requested this.

Collapse
 
aershov24 profile image
Alex 👨🏼‍💻FullStack.Cafe

Hi Jacob, yes we store historical daily Gold (and Silver) prices from LBMA in Mongo and update them daily (using great node-scheduler job scheduler). This data available since 1968 so there are not so many records (around 20k). The reason there is no reliable data source for that data type anywhere to pull them by request and it usually available only as CSV files or published as static HTML data and scattered around internet. We obviously use caching (in memory) once the data is queried (life & historical).

Collapse
 
matbcf profile image
matbcf

Hi Alex, I'm interested in this project and what's your opinion about Node.js and React.
Thanks in advance

Collapse
 
aershov24 profile image
Alex 👨🏼‍💻FullStack.Cafe • Edited

Ok, so React feels definitely more lightweight than Angular (I was using Angular for FullStack.Cafe and CodeStack.Cafe for 2.5 years so far). My current bundle size is 170kb (Brottli). The best I could get from Angular was 260kb (including Material UI). Can be improved even further with proper lazy loading and hooks refactoring. Having JS (and not TS) on frontend and backend helps with speed of development and to stay in the same language context. Node (Express) rules for simple fast APIs. If you want to horizontally scale API use Throng. In overall I would recommend MERN (mongo+express+react+node) stack for any modern startup/side project. I don't separate FrontEnd and BackEnd solutions for deployment so it's kinda monolit but that can be refactored easily. From hosting perspective I use Heroku + mLab (for Mongo). Billing - obviously Stripe is a king. CSS - still use Bootrstrap 4 but want to try Tailwind in the future.

And this is result of site speed from GTMetrix:

image

Collapse
 
aershov24 profile image
Alex 👨🏼‍💻FullStack.Cafe

See my updates after more refactoring (components lazy loading). NO way you can achieve the same with Angular.

Collapse
 
francarranza profile image
Francisco Carranza

Hi Alex, really interesting project! How did you came up with the idea? I'm really interested in building small Saas but I don't really know where to start. Any advice?