:mag_right: :bar_chart: Cognition

A charted data dashboard to track metrics across the fluent network.

:paperclip: Pre Reqs

# install native bun
curl -fsSL https://bun.sh/install | bash

# install via homebrew
brew tap oven-sh/bun && brew install bun

:rocket: Bootstrap

git clone github:Fluent-Finance/cognition.git
cd cognition

:satellite: Install Pkgs

bun install

:sparkles: Shell Env

# source .env.bootstrap
. ./bootstrap.env 

:hammer: Build

bun do

:vertical_traffic_light: Run

bun go

:checkered_flag: Preview (production)

bun done

:triangular_ruler: Testing (Integration & Unit)

# Deps -- need to run only once
bunx playwright install

# will run both sets of tests
# and watch for file changes
bun run test

# test specific suite 
bun run test:unit
bun run test:integration

Docker Build

docker buildx build -f Dockerfile \
  --ssh default \
  --platform linux/arm64 \
  --build-arg APP_ENV=$APP_ENV \
  --build-arg APP_PORT=$PORT \
  --build-arg APP_HOST=$APP_ENV \
  --build-arg SERVICE_NAME=$SERVICE_NAME \
  --build-arg APP_LOG_LEVEL=$LOG_LEVEL \
  --tag "cognition:latest" \
  .

Docker Run

docker run -it \
  --label cognition \
  --name cognition \
  --env-file build.env \
  -p 0.0.0.0:3333:3333/tcp \
  --rm \
  -t cognition:latest \

:closed_lock_with_key: Secure Shell / Runtime

# want to stay secure even in the shell
# you can extract env values from password manager
# if using 1Password or Bitwarden, e.g. uses 1Password
export OP_CONNECT_HOST=https://vault.fluent.finance
export OP_CONNECT_TOKEN="$(cat < $HOME/.config/op/op_fluent_token)"

# only run command if using 1password local vault 
op inject -i bootstrap.env > .env.bootstrap

# Not using a pw manager ?
# you will need to update the env vars 
# with your data after copy 
cp bootstrap.env .env.bootstrap

# Ultra Secure Method (1password)
# op run --env-file=bootstrap.env -- bun fun

# uses secure vault and 1password cli
# to read in environment variables into runtime
# secrets are not exposed even in the shell 
#
# bun run --bun dev --port $PORT --host $HOST

:recycle: Decentralized Deploys

:file_folder: Data SOURCES

Off Chain

On Chain

:gift_heart: Powered By NextGen Technology


Top categories

Loading Svelte Themes