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.
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.
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
.
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.
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
In the event you would like to clear the cached database results, the following results will flush (reset) the cache.
redis-cli FLUSHDB
The following steps will build a docker container that will automatically run the NEAR Stats dashboard and Redis server.
Download Docker Desktop and ensure it is open and running to start the docker daemon.
docker build -t nearstats .
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.
To contribute to NEAR Stats, please see CONTRIBUTING.
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.