near / near-stats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NEAR Stats

Welcome to the NEAR Stats Repo.

NEAR Stats is a dashboard to track the growth of apps on the NEAR Platform. The data behind the NEAR Stats Project comes from the NEAR Analytics Database for aggregated data, and the NEAR Ecosystem Repo for app data. Alongside the dashboard is an API that provides that data behind all of the NEAR Stats visualizations.

Please visit the API Wiki for API Documentation. Details of the structure and code for the dashboard can be found in the Front End Wiki.

Running NEAR Stats

Environment Variables

Environment variables required for connection to the NEAR Analytics database are required in a .env file. An example of the required variables are included in the .env-example. This file can be renamed .env, however the credentials should be checked against the NEAR Analytics Repo.

Running NEAR Stats Locally

NEAR Stats is developed using Next.js. To install the dependencies needed for the project, run yarn. The project can be ran in development mode using yarn dev or alternatively in production mode with yarn build followed by yarn start.

Additional Dependencies

Redis Cache Server

A Redis Caching Server is highly recommended to improve loadings time and load on the NEAR Analytics Database. Running NEAR Stats without a Redis Caching Server is possible without any additional modification however queries to the NEAR Analytics Database may be blocked during times of high volume. The Redis Caching Server will cache all results for a period of 24 hours.

Redis Installation Mac

The following terminal commands will install and run a local Redis Server on a Mac. Additional information and instructions for alternative systems can be found on the Redis Website.

mkdir redis && cd redis
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
redis-server

Flushing Redis server cache

In the event you would like to clear the cached database results, the following results will flush (reset) the cache. redis-cli FLUSHDB

DOCKER

The following steps will build a docker container that will automatically run the NEAR Stats dashboard and Redis server.

Install Docker

Download Docker Desktop and ensure it is open and running to start the docker daemon.

Docker Build

docker build -t nearstats .

Docker Start

The docker container can be started from Docker Desktop Run the image and set the local host port to 3000 visit http://localhost:3000 in your browser.

Contributing

To contribute to NEAR Stats, please see CONTRIBUTING.

License

NEAR Stats is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-MIT and LICENSE-APACHE for details.

About

License:Apache License 2.0


Languages

Language:JavaScript 89.3%Language:SCSS 10.1%Language:Dockerfile 0.5%Language:Shell 0.0%