Getting Started
This guide will help you set up your development environment and understand the basic architecture of the Ava Portfolio Manager project.
Prerequisites
Before you begin, ensure you have the following installed on your system:
Node.js (v18.x or higher)
Bun (v1.0.0 or higher)
Docker and Docker Compose (optional, for containerized development)
A code editor (we recommend Visual Studio Code)
Setting Up Your Development Environment
1. Clone the Repository
git clone https://github.com/your-org/ava-portfolio-manager.git
cd ava-portfolio-manager2. Install Dependencies
The project is structured as a monorepo with two main directories:
server/- Backend Node.js serverfrontend/- Next.js frontend application
Install dependencies for both:
3. Set Up Environment Variables
Create the necessary environment files:
Edit the .env.local files with your specific configuration values.
4. Start Development Servers
You can start both the frontend and backend in development mode:
The backend server will be available at http://localhost:3001 and the frontend at http://localhost:3000.
Project Structure
Backend (Server)
The backend is organized as follows:
Frontend
The frontend is built with Next.js and organized as follows:
Core Concepts
Agent System
The Ava Portfolio Manager is built around a multi-agent system:
Eliza Agent - The primary conversational interface that processes natural language and coordinates between other agents.
Sonic Agent - Handles DeFi protocol interactions, including transactions and data fetching.
Move Agent - Provides portfolio analysis, strategy suggestions, and financial modeling.
Task Manager Agent - Coordinates tasks between agents and manages the workflow.
Event Bus
Agents communicate through a central event bus, which follows a publish-subscribe pattern:
Plugin System
The Sonic Agent uses a plugin system to interact with different DeFi protocols:
Development Workflow
Adding a New Feature
Create a branch:
Implement your changes:
For new agent capabilities, add methods to the relevant agent class
For new UI features, add components and update pages
Add tests for your changes
Run tests:
Submit a pull request:
Ensure your code follows the project's style guide
Include a description of your changes
Reference any related issues
Adding a New Protocol Integration
To add support for a new DeFi protocol:
Create a new plugin in
server/src/agents/plugins/:Implement the plugin with necessary methods:
Update the Sonic Agent to use your plugin:
Testing
Unit Tests
Run unit tests for a specific component:
Integration Tests
Integration tests can be run with:
End-to-End Tests
End-to-end tests use Cypress:
Debugging
Server Debugging
For detailed server logs:
Transaction Debugging
To debug blockchain transactions:
Frontend Debugging
For frontend debugging, use the browser's developer tools. The application also provides debug information in the browser console when running in development mode.
Common Issues and Solutions
"Cannot find module" Error
If you encounter a "Cannot find module" error:
Server Connection Issues
If the frontend can't connect to the backend:
Check that both servers are running
Verify the API URL in the frontend's
.env.localCheck for any CORS issues in the browser console
Database Connection Issues
If there are database connection errors:
Check your database configuration in
server/.env.localEnsure the database server is running
Try resetting the database with
bun run db:reset
Next Steps
Once you have your development environment set up, you can:
Explore the API Documentation
Learn about Adding New Agents
Read the Architecture Overview
Check out the Protocol Integrations
Contributing
Before submitting your changes, please:
Ensure all tests pass
Update documentation if necessary
Follow the coding style guidelines
Write meaningful commit messages
Need Help?
If you need assistance:
Check the project's GitHub issues
Reach out to the dev team on Discord
Consult the Troubleshooting Guide
Last updated