Nexent Development Guide
This guide provides comprehensive information for developers to understand and contribute to the Nexent project, covering architecture, technology stack, development environment setup, and best practices.
🏗️ Overall Architecture
nexent/
├── frontend/ # Frontend application (Next.js + TypeScript)
├── backend/ # Backend services (FastAPI + Python)
├── sdk/ # Python SDK
├── docker/ # Docker deployment configuration
├── make/ # Build scripts
├── test/ # Test code
└── assets/ # Static resources
🛠️ Technology Stack
Frontend Tech Stack
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- UI Library: React + Tailwind CSS
- State Management: React Hooks
- Internationalization: react-i18next
- HTTP Client: Fetch API
Backend Tech Stack
- Framework: FastAPI
- Language: Python 3.10+
- Database: PostgreSQL + Redis + Elasticsearch
- File Storage: MinIO
- Task Queue: Celery + Ray
- AI Framework: smolagents
- Vector Database: Elasticsearch
Deployment Tech Stack
- Containerization: Docker + Docker Compose
- Reverse Proxy: Nginx
- Monitoring: Built-in health checks
- Logging: Structured logging
🚀 Development Environment Setup
Environment Requirements
- Python 3.10+
- Node.js 18+
- Docker & Docker Compose
- uv (Python package manager)
- pnpm (Node.js package manager)
Infrastructure Deployment
Before starting backend development, you need to deploy infrastructure services. These services include databases, caching, file storage, and other core components.
cd docker
./deploy.sh --mode infrastructure
Important Notes
Infrastructure mode will start PostgreSQL, Redis, Elasticsearch, and MinIO services. The deployment script will automatically generate keys and environment variables needed for development and save them to the .env
file in the root directory. Generated keys include MinIO access keys and Elasticsearch API keys. All service URLs will be configured as localhost addresses for convenient local development.
Backend Setup
cd backend
uv sync --all-extras
uv pip install ../sdk
Notes
--all-extras
will install all optional dependencies, including data processing, testing, and other modules. Then install the local SDK package.
Frontend Setup
cd frontend
pnpm install
pnpm dev
Service Startup
Before starting services, you need to activate the virtual environment:
# Execute in the project root directory
source venv/bin/activate # Activate virtual environment
Nexent includes three core backend services that need to be started separately:
source .env && python backend/data_process_service.py # Data processing service
source .env && python backend/main_service.py # Main service
source .env && python backend/nexent_mcp_service.py # MCP service
Important Notes
All services must be started from the project root directory. Each Python command should be preceded by source .env
to load environment variables. Ensure infrastructure services (database, Redis, Elasticsearch, MinIO) are started and running properly.
🔧 Development Module Guide
🎨 Frontend Development
- Tech Stack: Next.js 14 + TypeScript + React + Tailwind CSS
- Core Features: User interface, real-time chat, configuration management, internationalization
- Details: See Frontend Overview
🔧 Backend Development
- Tech Stack: FastAPI + Python 3.10+ + PostgreSQL + Redis + Elasticsearch
- Core Features: API services, agent management, data processing, vector search
- Details: See Backend Overview
🤖 AI Agent Development
- Framework: Enterprise agent framework based on smolagents
- Core Features: Agent creation, tool integration, reasoning execution, multi-modal support
- Custom Agents: See Agents
- System Prompts: Located in
backend/prompts/
- Implementation Steps: Create instance → Configure tools → Set prompts → Test run
- Details: See Agents
🛠️ Tool Development
- MCP Tool System: Based on Model Context Protocol
- Development Flow: Implement logic → Register tool → Restart service
- Protocol Compliance: Tool development must follow MCP protocol
- Detailed Specification: See Tool Development Guide
📦 SDK Development Kit
- Features: Complete interfaces for AI agents, model calling, tool integration
- Modules: Core agents, data processing, vector database
- Details: See SDK Overview
📊 Data Processing
- File Processing: Supports 20+ formats
- Chunking Strategies: basic, by_title, none
- Streaming Processing: Memory optimization for large files
- Details: See Data Processing Guide
🏗️ Build & Deployment
Docker Build
For detailed build instructions, see Docker Build Guide
📋 Development Best Practices & Important Notes
Code Quality
- Test-Driven: Write unit tests and integration tests
- Code Review: Follow team coding standards
- Documentation: Update related documentation timely
- Error Handling: Comprehensive exception handling and logging
Performance Optimization
- Async Processing: Use async architecture for performance
- Caching Strategy: Proper use of caching mechanisms
- Resource Management: Pay attention to memory and connection pool management
- Monitoring & Debugging: Use performance monitoring tools
Security Considerations
- Input Validation: Strictly validate all input parameters
- Access Control: Implement appropriate access controls
- Sensitive Information: Properly handle sensitive data like API keys
- Security Updates: Regular dependency and security updates
Important Development Notes
- Service Dependencies: Ensure all services are started before testing
- Code Changes: Restart related services after code modifications
- Development Mode: Use debug mode in development environment
- Prompt Testing: System prompts need thorough testing
- Environment Variables: Ensure configuration in
.env
file is correct - Infrastructure: Ensure infrastructure services are running properly before development
💡 Getting Help
Documentation Resources
- Installation Guide - Environment setup and deployment
- Model Providers - Model configuration and API acquisition
- FAQ - Frequently asked questions
Community Support
- Discord Community - Real-time communication and support
- GitHub Issues - Issue reporting and feature requests
- Contributing Guide - Participate in project development