Autonomous smart contract security auditing engine — paste a GitHub repo URL, run a hunt, and get Code4rena or Immunefi formatted vulnerability reports powered by Claude AI.
pnpm --filter @workspace/api-server run dev— run the API server (port 8080, proxied at/api)pnpm --filter @workspace/bloodhound-ui run dev— run the React frontend (proxied at/)pnpm run typecheck— full typecheck across all packagespnpm run build— typecheck + build all packagespnpm --filter @workspace/api-spec run codegen— regenerate API hooks + Zod schemas from OpenAPI specpnpm --filter @workspace/db run push— push DB schema changes (dev only)- Required env:
DATABASE_URL— Postgres connection string,SESSION_SECRET— session signing,OPENROUTER_API_KEY— your OpenRouter key for Claude access
- pnpm workspaces, Node.js 24, TypeScript 5.9
- API: Express 5 (esbuild CJS bundle)
- Frontend: React + Vite + Tailwind + shadcn/ui + wouter routing
- DB: PostgreSQL + Drizzle ORM
- AI: Anthropic Claude via OpenRouter (
openaiSDK pointed athttps://openrouter.ai/api/v1, modelanthropic/claude-sonnet-4) - Validation: Zod (
zod/v4),drizzle-zod - API codegen: Orval (OpenAPI → React Query hooks + Zod schemas)
lib/db/src/schema/hunts.ts— DB schema +Findinginterfacelib/api-spec/openapi.yaml— OpenAPI spec (source of truth for contracts)lib/api-zod/src/generated/api.ts— Zod schemas for Express routeslib/api-client-react/src/generated/— React Query hooks + TypeScript types for frontendartifacts/api-server/src/routes/hunts/index.ts— hunt CRUD + SSE progress routesartifacts/api-server/src/lib/hunt-engine.ts— full audit pipeline orchestratorartifacts/api-server/src/lib/ai-analyzer.ts— Anthropic integration + report generationartifacts/api-server/src/lib/heuristics.ts— 8 static analysis checksartifacts/api-server/src/lib/github.ts— GitHub API Solidity file fetcherartifacts/bloodhound-ui/src/pages/home.tsx— Dashboard + new hunt formartifacts/bloodhound-ui/src/pages/hunt-results.tsx— Live SSE progress + findings display
- Contract-first API: OpenAPI spec in
lib/api-spec/drives both server validation (Zod) and client hooks (React Query) via Orval codegen. Run codegen after any spec change. - SSE for progress: Hunt pipeline emits real-time progress events over Server-Sent Events at
GET /api/hunts/:id/progress. Frontend uses nativeEventSource. In-memoryMap<huntId, listeners[]>— not clustered. - AI via OpenRouter: Claude is accessed via OpenRouter using the
openaiSDK pointed athttps://openrouter.ai/api/v1. RequiresOPENROUTER_API_KEYsecret. Billing flows through your OpenRouter account. - Hunt pipeline: GitHub API (up to 40 Solidity files) → regex parser → 8 heuristic checks → Claude AI deep analysis → save findings + markdown report to DB.
- Two report modes:
code4rena(structured competitive audit format) andimmunefi(bug bounty format). Mode selected at hunt creation time.
- Paste any public GitHub repo URL to start an autonomous security hunt
- Choose AI model: Haiku 4.5 (fast/cheap), Sonnet 4 (balanced default), Opus 4 (deepest)
- Real-time streaming progress (file fetching → parsing → heuristics → AI analysis)
- Findings organized by severity: critical, high, medium, low, informational, gas
- Every finding includes a Proof of Concept (Foundry-style for critical/high, step-by-step for lower)
- Download complete audit reports as
.mdin Code4rena or Immunefi format - Dashboard with aggregate stats (total hunts, findings, critical/high counts)
- Hunt history with status tracking
Populate as you build.
- Always run
pnpm --filter @workspace/api-spec run codegenafter editing the OpenAPI spec before touching route or frontend code. - Never use
console.login server code — usereq.login route handlers andloggerfrom./lib/loggerelsewhere. - The SSE progress endpoint uses an in-memory listener map — restarting the server loses in-flight hunt listeners (hunts themselves persist in DB).
huntsTableprimary key istext("id")(UUID string), not a serial integer.- Rate limits: 120 req/min global, 10 hunt creations/hour per IP (express-rate-limit, in-memory — resets on restart).
- GitHub API: authenticated via
GITHUB_TOKENsecret (5000 req/hr); without it falls back to 60 req/hr unauthenticated. - Repo size guard: rejects repos with >300 Solidity files; fetches up to 50 files for analysis.
- See the
pnpm-workspaceskill for workspace structure, TypeScript setup, and package details - Anthropic AI:
.local/skills/ai-integrations-anthropic/