Local Development

Run Atract locally for development.

Prerequisites

  • Node.js 18+

  • PostgreSQL 14+

  • Git

Clone Repository

git clone https://github.com/Atractapp/atractv2.git
cd atractv2/web

Install Dependencies

npm install

Database Setup

Create database:

createdb atract_dev

Run migrations:

npx prisma migrate dev

Seed data (optional):

npx prisma db seed

Environment Variables

Copy example env file:

cp .env.example .env.local

Edit .env.local with your values:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/atract_dev"

# Hyperliquid (testnet)
NEXT_PUBLIC_HL_API_BASE_URL="https://api.hyperliquid-testnet.xyz"
HL_RPC_URL="https://rpc.hyperliquid-testnet.xyz/evm"
HL_AGENT_PRIVATE_KEY="0x..."
ORACLE_PRIVATE_KEY="0x..."

# Auth
SESSION_SECRET="your-random-secret-here"
NEXT_PUBLIC_SITE_URL="http://localhost:3000"

See Environment Variables for full list.

Run Development Server

npm run dev

Open http://localhost:3000

Run Oracle Service

In a separate terminal:

npm run oracle:start

Testing

Run tests:

npm test

Run with coverage:

npm run test:coverage

Build for Production

npm run build
npm start

Troubleshooting

Database connection fails:

  • Verify PostgreSQL is running

  • Check DATABASE_URL format

  • Ensure database exists

Hyperliquid API errors:

  • Verify HL_API_BASE_URL

  • Check agent key is valid

  • Ensure testnet is accessible

Oracle not updating:

  • Check ORACLE_PRIVATE_KEY

  • Verify Hyperliquid RPC connection

  • Check oracle logs for errors

Last updated