Live demo: https://alphaforge-five.vercel.app
AlphaForge is an AI trading agent built for hackathon use cases, combining market signals, LLM decision-making, risk controls, paper trading execution, and ERC-8004 on-chain identity.
Every cycle, the agent:
- fetches market signals from PRISM,
- sends the current market + portfolio context to an LLM,
- applies strict risk checks,
- executes a paper trade through Kraken CLI,
- stores everything in PostgreSQL via Prisma,
- optionally posts attestations and feedback on Sepolia through ERC-8004 flows.
Next.js Dashboard
├─ UI pages
├─ API routes
└─ agent controls
Agent Loop
├─ PRISM market signals
├─ LLM decision engine
├─ risk engine
├─ Kraken paper execution
└─ PostgreSQL persistence
On-chain Layer
└─ ERC-8004 identity / validation / reputation on Sepolia
The app pulls live market context from PRISM, including price, momentum, and risk-related signals.
The agent sends structured input to the LLM and expects a constrained output like:
BUYSELLHOLD
Each decision also includes confidence and reasoning.
Before any execution, the agent applies hard guardrails:
- stop-loss,
- take-profit,
- max exposure,
- duplicate position prevention.
If the action passes the risk engine, AlphaForge executes a paper trade through Kraken CLI.
Trades, runs, and config are saved with Prisma + PostgreSQL.
The agent can publish identity and trading-related attestations to Sepolia using ERC-8004-compatible flows.
/→ live dashboard/trades→ trade history/signals→ market signals/agent→ agent configuration
POST /api/agent/startPOST /api/agent/stopGET /api/agent/statusPOST /api/kraken/executeGET /api/market/signals
app/
agent/
api/
signals/
trades/
components/
agent/
charts/
dashboard/
navigation/
ui/
lib/
agent/
kraken/
onchain/
prism/
prisma.ts
env.ts
runtime-store.ts
prisma/
schema.prisma
migrations/
scripts/
register-agent.ts
check-balance.ts
check-trades.ts
worker.ts
- Next.js
- React
- Tailwind CSS
- shadcn/ui
- Prisma
- PostgreSQL (
pg+@prisma/adapter-pg) - OpenAI
- PRISM API
- Kraken CLI
- viem
- Sepolia
vercel link --yes --scope <team-slug> --project alphaforge(or create the project in the dashboard).- Push environment variables:
pnpm run vercel:env
This reads.env, forcesKRAKEN_CLI_SIMULATE=trueon Production (Kraken CLI binary is not available in serverless), and ensuresCRON_SECRETexists for/api/cron/agent-tick. vercel deploy --prod --yes
Cron on the Hobby plan is limited to once per day (see vercel.json). Set DATABASE_URL (or Prisma Postgres STORAGE_* vars) on Vercel so the app uses one shared Postgres instance.
The app targets PostgreSQL via DATABASE_URL (connection URL also read from STORAGE_PRISMA_DATABASE_URL / STORAGE_POSTGRES_URL when using Vercel’s Prisma Postgres integration).
- Provision a database (e.g. Prisma Postgres, Neon, or
docker compose up -dwith docker-compose.yml). - Set
DATABASE_URLin.envto apostgresql://orpostgres://URL. - Apply migrations:
pnpm exec prisma migrate deploy - Builds on Vercel run
prisma migrate deploythennext buildviascripts/vercel-build.cjs. Demo seed is skipped on Vercel by default (so deploys don’t wipeTrade/AgentRun). To seed once, setSEED_DEMO_ON_BUILD=truein the Vercel environment for that deploy, or runpnpm exec tsx scripts/seed-demo.tslocally against yourDATABASE_URL.
Vercel runs short-lived functions; use a separate process for the infinite loop and for the kraken binary:
- Locally:
pnpm workerwithKRAKEN_CLI_SIMULATE=falseandKRAKEN_CLI_PATHpointing at your install. - Container: build Dockerfile.worker, install or mount Kraken CLI in the image, pass the same
.envas the Next app.
Hackathon eligibility (e.g. early.surge.xyz) is outside this repo—register your team there per lablab rules.
pnpm installCreate .env (or .env.local) and add your local values. DATABASE_URL must be a PostgreSQL URL (postgres:// or postgresql://). Use Prisma Postgres, Neon, or run docker compose up -d and point DATABASE_URL at the container.
Example:
DATABASE_URL="postgresql://USER:PASSWORD@HOST:5432/DATABASE?sslmode=require"
TRADING_MODE="paper"
KRAKEN_API_KEY=""
KRAKEN_API_SECRET=""
KRAKEN_CLI_PATH=""
KRAKEN_CLI_SIMULATE="true"
PRISM_API_KEY=""
OPENAI_API_KEY=""
LLM_PROVIDER="openai"
LLM_MODEL="gpt-4o-mini"
AGENT_PRIVATE_KEY=""
AGENT_WALLET_ADDRESS=""
BASE_SEPOLIA_RPC=""
SEPOLIA_RPC_URL=""pnpm exec prisma migrate deployFor local schema iteration (creates migration files):
pnpm db:migratepnpm devOpen http://localhost:4000.
- Start the app.
- Open
/agent. - Start the worker.
- Watch signals update.
- Let the loop generate a decision.
- Inspect trades in
/trades. - Show persisted data and on-chain registration.
| Field | Value |
|---|---|
| Agent ID | 45 |
| Network | Ethereum Sepolia (chainId 11155111) |
| Wallet | 0x34A0aC099E6812701e970024fff89aDDb95c4426 |
| Registration TX | 0x97a063... |
| Agent card | /agent-registration.json |
Contracts (Sepolia):
| Contract | Address |
|---|---|
| AgentRegistry | 0x97b07dDc405B0c28B17559aFFE63BdB3632d0ca3 |
| HackathonVault | 0x0E7CD8ef9743FEcf94f9103033a044caBD45fC90 |
| RiskRouter | 0xd6A6952545FF6E6E6681c2d15C59f9EB8F40FdBC |
| ReputationRegistry | 0x423a9904e39537a9997fbaF0f220d79D7d545763 |
| ValidationRegistry | 0x92bF63E5C7Ac6980f237a7164Ab413BE226187F1 |
- AI-driven trading decisions
- strict risk engine before execution
- paper trading flow through Kraken CLI
- PostgreSQL persistence for reproducible demo
- ERC-8004 identity / validation / reputation integration
- clean dashboard for live inspection
- This project is configured for paper trading during demos.
- Never commit real secrets.
- Never reuse exposed private keys.
- Use fresh credentials before any public demo or deployment.
-
.env.localis not committed -
.env.exampleis included -
dev.dbis ignored - agent registration JSON is available in
public/ - README includes demo steps
- screenshots or GIF added before final submission
MIT