GoldAPI.io - How to build Gold & Silver Prices REST API and Dashboard using Node.js + React in 5 days
Tags: api, react, node
Published: 2020-05-28 08:48:29

---
title: GoldAPI.io - How to build Gold & Silver Prices REST API and Dashboard using Node.js + React in 5 days
published: true
description: GoldAPI.io - How to build Gold & Silver Prices REST API using Node.js + React in 5 days
tags: api, react, node
---

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 avoid tunnel vision and get some practice with React.

The new service called [GoldAPI.io](https://www.goldapi.io). It provides historical daily Gold & Silver prices since 1968 (LBMA AM Fix rates in USD) as well as real-time Gold and Silver Spot Rates in 169 different currencies. Targeted audience - mobile/financial app devs, bullion dealers, wealth management firms, traders.

![image](https://user-images.githubusercontent.com/13550565/83119451-5073e300-a102-11ea-86e5-057b8c9f9643.png)

* **UVP**: The only Gold & Silver Prices REST JSON API you need
* **Value metric**: reqs per day. Pricing - free (100 reqs/daily), 19.99$ - 5000 reqs/daily, Enterprise - Unlimited, by request.

![image](https://user-images.githubusercontent.com/13550565/83119778-b7919780-a102-11ea-9fb9-04fa06469edd.png)

From development perspective 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 (after Brottli compression). The best I could get from Angular was 260kb (including Material UI). React builds faster (1 min vs 3-4 mins for Angular 9). Can be improved even further with proper lazy loading (for routes) and hooks refactoring (P.S. see the refactoring results below). Having JS (and not TS) on frontend and backend helps with speed of development and staying in the same language context. Node (Express) rules for simple fast APIs. If you want to horizontally scale API across multiple CPUs use Throng. Cache everything.

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 monolithic 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. Deployment - Heroku Git as one simple push.

And this is site speed results from GTMetrix:

![image](https://user-images.githubusercontent.com/13550565/83210708-210ab800-a18e-11ea-8c46-64cb242f280c.png)

In overall I spent 5 days (idea came last Friday) on implementation reusing some code from my previous products (including API billing metering and Stripe integration). Launched yesterday, commented on Quora and in 3 hours got my first sign up. So far got 4 users for 24 hours with zero marketing.

If you build APIs as products and interested how I developed and how I plan to market gimme a shout or comment there.

**P.S.** This is results of refactored version with components lazy loading. BlogPost and Dashboard components are lazy loaded using routing. And this is awesome guys.

Before (for Landing Page):
![image](https://user-images.githubusercontent.com/13550565/83215933-a5633800-a19a-11ea-9a32-bd113c923b1e.png)

After:

![image](https://user-images.githubusercontent.com/13550565/83215808-62a16000-a19a-11ea-84c0-0213aa68ba5b.png)

![image](https://user-images.githubusercontent.com/13550565/83215647-0f2f1200-a19a-11ea-9fc6-b4848089fce4.png)

GTMetrix:
![image](https://user-images.githubusercontent.com/13550565/83215685-2110b500-a19a-11ea-88a8-cd5db9c5db88.png)

Google Site Speed:
![image](https://user-images.githubusercontent.com/13550565/83215556-d68f3880-a199-11ea-80d4-ec7c24f7e06a.png)

Stay safe.
Alex @ GAPI