Skip to content

HackHumanityOrg/hos-intel

Repository files navigation

HoS Intelligence — Vote Simulator

Fmt Lint Tests Build

Model governance outcomes before they happen. The Vote Simulator is an interactive scenario-planning tool for NEAR Protocol's House of Stake governance body. It pulls live on-chain delegate data and lets you simulate how proposals will play out under different voting rules, delegate behaviors, and strategic conditions.

Vote Simulator — scenario modeling with live delegate data


What It Does

Vote Simulator

The core of the app. Build named scenarios, adjust parameters, and see projected outcomes in real time:

  • Scenario management — create, duplicate, rename, compare, and export scenarios
  • Voting rules — toggle between supermajority (67%) and simple majority (>50%), bundle or individual proposal mode
  • Per-delegate predictions — engine-generated predictions with manual overrides and optional AI analysis
  • Synthetic actors — add hypothetical delegates to model "what if" scenarios
  • veNEAR adjustments — model changes to delegate voting power
  • Strategic analysis — procedural & legitimacy risk scoring across four dimensions (Interpretation, Precedent, Narrative, Retry Clarity)
  • Scenario comparison — side-by-side evaluation of multiple scenarios with projected outcomes
  • Export — PDF (print-ready A4 landscape), Excel spreadsheet, and JSON workspace import/export

Delegate Intelligence

Browse all veNEAR delegates with voting history, participation rates, and power distribution.

All Delegates — veNEAR holdings, voting history, participation

Proposal Explorer

On-chain proposal data with vote breakdowns, thresholds, outcomes, and per-delegate drill-down.

All Proposals — on-chain vote data with visual breakdowns


Data Sources

All data is sourced from on-chain records — never fabricated or mocked.

Source What
Agora Governance API Proposals, delegate rosters, vote records
NEAR RPC (venear.dao) veNEAR balances via ft_balance_of
NearBlocks Transaction explorer links

Tech Stack

  • Next.js 16 — App Router, Server Components, Cache Components
  • React 19 — with TanStack Query for data management
  • Zustand — client-side state for simulator scenarios
  • Tailwind CSS + shadcn/ui — UI components
  • Zod — runtime API response validation
  • ExcelJS + react-to-print — export capabilities

Getting Started

Prerequisites

  • Node.js >= 20
  • pnpm 10.x
  • Docker Engine + Docker Compose v2 (for container deployment)

Install & Run

git clone https://github.com/HackHumanityOrg/hos-intel.git
cd hos-intel
pnpm install
cp command-center/.env.example command-center/.env
pnpm dev

Open http://localhost:3333.

Environment Variables

Copy the example env file and fill in values as needed:

cp command-center/.env.example command-center/.env
Variable Required Description
NEXT_PUBLIC_APP_URL Yes Canonical app URL and OpenRouter referer header
NEXT_PUBLIC_AGORA_ENV No Upstream governance API environment (prod, staging, dev, local)
NEXT_PUBLIC_NAV_PAGES No Comma-separated nav ids to expose in the UI
ANTHROPIC_API_KEY No Enables AI-assisted vote analysis
OPENAI_API_KEY No Fallback AI provider
OPENROUTER_API_KEY No Alternative AI provider
AI_PROVIDER, AI_MODEL No Explicit AI provider/model override

The simulator works fully without any API keys — AI analysis is an optional enhancement.


Root Commands

pnpm dev             # Start dev server on :3333
pnpm build           # Production build
pnpm start           # Start production server
pnpm lint            # TypeScript checking
pnpm typecheck       # TypeScript checking
pnpm test            # Run Vitest unit tests
pnpm test:e2e        # Run Playwright e2e tests
pnpm format:check    # Prettier format check
pnpm docker:build    # Build Docker image
pnpm docker:up       # Start with Docker Compose
pnpm docker:down     # Stop Docker Compose
pnpm health          # Check /healthz endpoint
pnpm deploy:check    # Full pre-deploy quality gate

All root scripts are thin wrappers around the command-center app.


Deployment

Docker

pnpm docker:build
docker run --rm \
  --name hos-command-center \
  -p 3333:3333 \
  --env-file command-center/.env \
  hos-command-center
pnpm health

The image uses Next.js standalone output, runs as a non-root user, and honors PORT and HOSTNAME at runtime.

Docker Compose

cp command-center/.env.example command-center/.env
pnpm docker:up
docker compose logs -f command-center
pnpm health
pnpm docker:down

Standalone Node

pnpm build
HOSTNAME=0.0.0.0 PORT=3333 node command-center/.next/standalone/command-center/server.js

Project Structure

hos-intel/
  command-center/              # Next.js application
    Dockerfile                 # Production image build
    src/
      app/
        simulator/             # Vote Simulator (main feature)
        delegates/             # Delegate directory & profiles
        proposals/             # Proposal explorer & vote breakdowns
        api/                   # Route handlers (AI analysis, governance data)
        healthz/               # Health check endpoint
      components/              # UI components (shadcn/ui + custom)
      lib/                     # Data fetching, prediction engine, utilities
    e2e/                       # Playwright end-to-end tests
  docker-compose.yml           # Local single-service deployment
  scripts/                     # Secret scanning, git hooks
  docs/screenshots/            # README assets

Secret Protection

A pre-commit hook (installed automatically via pnpm install) scans staged files for accidentally committed secrets, API keys, and connection strings.


Contributing

Contributions welcome. Please open an issue first to discuss what you'd like to change.

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/my-change)
  3. Make your changes and run pnpm deploy:check
  4. Open a pull request

License

MIT — Created by Hack Humanity

About

House of Stake governance intelligence workspace

Resources

License

Stars

Watchers

Forks

Contributors

Languages