This guide provides detailed instructions for setting up the GraphDe development environment.
-
Node.js (v16 or higher)
- Download from nodejs.org
- Verify installation:
node --version
-
npm (comes with Node.js)
- Verify installation:
npm --version
- Verify installation:
-
Git
- Download from git-scm.com
- Verify installation:
git --version
-
OpenAI API Key
- Sign up at platform.openai.com
- Create an API key in your account settings
- Note: Requires billing setup for API usage
-
Nodit MCP API Key
- Sign up at nodit.io
- Obtain your API key from the dashboard
- Note: Currently supports 'web3' as the API key value
git clone <repository-url>
cd GraphDecd backend
# Install dependencies
npm install
# Create environment file
cp env.example .envEdit the .env file with your API keys:
PORT=3001
NODE_ENV=development
OPENAI_API_KEY=your_openai_api_key_here
NODIT_API_KEY=your_nodit_api_key_here
FRONTEND_URL=http://localhost:3000
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100cd ../frontend
# Install dependencies
npm installcd backend
npm run devcd frontend
npm startThe application should now be running at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
The backend uses a modular structure:
backend/
├── server.js # Main server file
├── routes/ # API route handlers
│ ├── chat.js # Chat endpoints
│ └── mcp.js # MCP endpoints
├── services/ # Business logic
│ ├── chatService.js # Chat processing
│ └── mcpService.js # MCP integration
├── middleware/ # Express middleware
│ └── errorHandler.js # Error handling
└── utils/ # Utility functions
├── validation.js # Input validation
├── intentExtractor.js # AI intent parsing
└── chartGenerator.js # Chart data generation
The frontend uses React with modern patterns:
frontend/
├── public/ # Static assets
├── src/
│ ├── components/ # React components
│ │ ├── ChatSidebar.js # Chat interface
│ │ └── ChartPanel.js # Chart display
│ ├── utils/ # Utility functions
│ │ └── cn.js # Class name utility
│ ├── App.js # Main app component
│ └── index.js # Entry point
├── tailwind.config.js # Tailwind configuration
└── package.json # Dependencies
Visit http://localhost:3001/api/health to verify the backend is running.
Try these example queries in the chat interface:
- Wallet Balance: "Show me the balance of 0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6 on Ethereum"
- Token Data: "What tokens does wallet 0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6 hold?"
- Chart Request: "Create a pie chart of the top tokens in this wallet"
Test the API endpoints directly:
# Test chat endpoint
curl -X POST http://localhost:3001/api/chat/message \
-H "Content-Type: application/json" \
-d '{"message": "Show me the balance of 0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6 on Ethereum", "sessionId": "test123"}'
# Test MCP endpoint
curl http://localhost:3001/api/mcp/balance/ethereum/0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6-
Port Already in Use
# Find process using port 3001 lsof -i :3001 # Kill the process kill -9 <PID>
-
Module Not Found Errors
# Clear npm cache npm cache clean --force # Reinstall dependencies rm -rf node_modules package-lock.json npm install
-
CORS Errors
- Ensure the frontend URL in
.envmatches your frontend address - Check that both servers are running
- Ensure the frontend URL in
-
API Key Issues
- Verify API keys are correctly set in
.env - Check API key permissions and billing status
- Test API keys independently
- Verify API keys are correctly set in
Enable debug logging:
# Backend
DEBUG=* npm run dev
# Frontend
REACT_APP_DEBUG=true npm start| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3001 |
NODE_ENV |
Environment | development |
OPENAI_API_KEY |
OpenAI API key | Required |
NODIT_API_KEY |
Nodit MCP API key | Required |
FRONTEND_URL |
Frontend URL | http://localhost:3000 |
RATE_LIMIT_WINDOW_MS |
Rate limit window | 900000 (15 min) |
RATE_LIMIT_MAX_REQUESTS |
Max requests per window | 100 |
The frontend uses the proxy configuration in package.json to forward API requests to the backend.
PORT=3001
NODE_ENV=production
OPENAI_API_KEY=your_production_openai_key
NODIT_API_KEY=your_production_nodit_key
FRONTEND_URL=https://your-domain.com
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=50# Backend
cd backend
npm run build
npm start
# Frontend
cd frontend
npm run build
# Deploy build/ folder to your hosting service