https://github.com/samarth-5/koinx-assignment
https://github.com/samarth-5/koinx-assignment
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/samarth-5/koinx-assignment
- Owner: samarth-5
- Created: 2025-01-10T17:43:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-10T19:24:02.000Z (4 months ago)
- Last Synced: 2025-01-17T22:15:57.079Z (4 months ago)
- Language: JavaScript
- Size: 3.68 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KoinX-Assignment Backend
A server-side application built with Node.js and MongoDB to fetch and store cryptocurrency data (Bitcoin, Matic, and Ethereum) using the CoinGecko API. It provides an API endpoint to retrieve the latest statistics for any of the supported cryptocurrencies, as well as the standard deviation of the price over the last 100 records.
---


## Features
1. Background job that runs every 2 hours to fetch cryptocurrency data and stores it in MongoDB.
2. API `/stats` to retrieve the latest price, market cap, and 24-hour change for Bitcoin, Matic, and Ethereum.
3. API `/deviation` to return the standard deviation of the price of a requested cryptocurrency for the last 100 records.---
## Prerequisites
Before you begin, ensure you have the following installed:
- [Node.js](https://nodejs.org/) (v14+ recommended)
- [MongoDB](https://www.mongodb.com/) (local or cloud instance)
- [Nodemon](https://nodemon.io/) (optional, for development)---
## Environment Variables
Create a `.env` file in the project root with the following variables and put it in server folder:
```env
PORT=3000 # The port the server will run on
MONGO_URL= # MongoDB URI
API_KEY= # API Key for CoinGecko (if required)
```## Installation and Starting
First clone the repository to your local machine & then run the project:
```bash
git clone https://github.com/your-username/KoinX-Assignment.git
cd KoinX-Assignment
cd server
npm install
npm run dev
```