Developer Guide
Comprehensive guide for developers building on the ONVEXIS platform, including architecture insights, extension points, and customization options.
Architecture Overview
ONVEXIS follows a modern microservices-inspired architecture with distinct layers for presentation, business logic, and data persistence.
ONVEXIS Platform Architecture
🖥️ Frontend Layer
React 18 + TypeScript with Tailwind CSS, shadcn/ui components, and real-time WebSocket connections
🔗 API Gateway
Express.js REST API with authentication, rate limiting, and request validation
🧠 Business Logic
Trading engines, AI analysis services, risk management, and session orchestration
💾 Data Layer
PostgreSQL with Drizzle ORM, Redis for caching, and real-time collaboration storage
🌐 External Services
Market data feeds, AI/ML services (Anthropic Claude), WebRTC signaling, and notification systems
Technology Stack
Frontend
- • React 18
- • TypeScript
- • Tailwind CSS
- • Radix UI
- • Vite
Backend
- • Node.js
- • Express.js
- • TypeScript
- • Socket.IO
- • JWT Auth
Database
- • PostgreSQL
- • Drizzle ORM
- • Redis
- • Neon Serverless
AI/ML
- • Anthropic Claude
- • Custom Analytics
- • Real-time Inference
- • Behavioral Analysis
Extension Points
ONVEXIS provides several extension points for developers to add custom functionality.
🎯 Strategy Engine Extensions
Create custom trading strategies that integrate with the core execution engine.
// Custom Strategy Interface
interface CustomStrategy {
name: string;
description: string;
parameters: StrategyParameter[];
analyze(marketData: MarketData): StrategySignal;
execute(signal: StrategySignal): ExecutionPlan;
validate(plan: ExecutionPlan): ValidationResult;
}
// Register your strategy
registerStrategy(new MyCustomStrategy());
📊 Analysis Module Extensions
Add custom analysis tools and indicators to the platform.
// Custom Indicator Interface
interface CustomIndicator {
id: string;
name: string;
category: 'momentum' | 'volatility' | 'trend' | 'volume';
calculate(priceData: PriceData[]): IndicatorValue[];
getSignal(values: IndicatorValue[]): Signal;
}
🤖 AI Coach Extensions
Extend the AI coaching system with custom analysis and recommendations.
// Custom Coach Module
interface CoachModule {
name: string;
triggers: CoachTrigger[];
analyze(session: TradingSession): CoachingInsight[];
generateRecommendation(insight: CoachingInsight): Recommendation;
}
Plugin Development
🔌 Plugin Structure
ONVEXIS plugins follow a standard structure for easy integration:
/my-plugin/
├── package.json
├── plugin.config.js
├── src/
│ ├── index.ts
│ ├── components/
│ ├── services/
│ └── types/
└── README.md
⚙️ Plugin Configuration
// plugin.config.js
export default {
name: 'my-custom-plugin',
version: '1.0.0',
description: 'Custom analysis plugin',
author: 'Your Name',
permissions: [
'market-data:read',
'orders:write',
'ui:extend'
],
hooks: {
'session:start': 'onSessionStart',
'order:placed': 'onOrderPlaced'
}
};
Plugin Development Workflow
- Initialize Plugin: Use the ONVEXIS CLI to create a new plugin template
- Implement Logic: Add your custom business logic and UI components
- Test Integration: Use the development environment for testing
- Package Plugin: Bundle the plugin for distribution
- Deploy: Install the plugin in your ONVEXIS instance
Strategy Modules
📈 Custom Strategy Development
Build sophisticated trading strategies that integrate seamlessly with ONVEXIS execution systems.
import { BaseStrategy, MarketData, StrategySignal } from '@onvexis/strategy-sdk';
class MeanReversionStrategy extends BaseStrategy {
constructor(config: MeanReversionConfig) {
super('mean-reversion', config);
}
analyze(data: MarketData): StrategySignal {
const { price, volume, rsi } = data;
// Custom mean reversion logic
if (rsi < 30 && volume > this.config.volumeThreshold) {
return {
action: 'BUY',
confidence: 0.8,
quantity: this.calculatePosition(data),
reasoning: 'RSI oversold with high volume'
};
}
return { action: 'HOLD' };
}
private calculatePosition(data: MarketData): number {
// Position sizing logic based on volatility and risk
return this.config.baseSize * (1 / data.volatility);
}
}
Strategy Integration Points
- Market Data Access: Real-time and historical price data
- Execution Engine: Direct integration with order management
- Risk Management: Automatic position sizing and stop-loss integration
- Performance Tracking: Built-in metrics and analytics
UI Customization
🎨 Custom Components
Create custom React components that integrate with the ONVEXIS design system.
import { Card, CardHeader, CardContent } from '@onvexis/ui';
import { usePriceData } from '@onvexis/hooks';
export function CustomIndicator() {
const { price, trend } = usePriceData();
return (
<Card className="glass-card">
<CardHeader>
<h3 className="text-brand-primary">My Indicator</h3>
</CardHeader>
<CardContent>
<div className="text-brand-secondary">
{price} ({trend})
</div>
</CardContent>
</Card>
);
}
📊 Dashboard Panels
Add custom panels to the main dashboard with drag-and-drop positioning.
// Register custom panel
registerPanel({
id: 'custom-analysis',
title: 'Custom Analysis',
component: CustomAnalysisPanel,
defaultPosition: { x: 0, y: 0, w: 4, h: 3 },
category: 'analysis'
});
Design System Integration
ONVEXIS provides a comprehensive design system with pre-built components, consistent spacing, and brand colors.
// Available design tokens
:root {
--brand-primary: #1F8AEE;
--brand-secondary: #00F7C4;
--brand-alert: #F74B4B;
--brand-neutral-dark: #0D0F12;
--brand-neutral-light: #E6E8EB;
}
// Utility classes
.glass-card { /* Glassmorphism effect */ }
.quantum-glow { /* Signature glow effect */ }
.animate-slide-up { /* Smooth animations */ }
API Development
Creating Custom Endpoints
// Add custom route to server/routes.ts
app.post('/api/custom/analysis', async (req, res) => {
try {
const { sessionId, parameters } = req.body;
// Validate input
const validation = customAnalysisSchema.safeParse(req.body);
if (!validation.success) {
return res.status(400).json({ error: validation.error });
}
// Custom analysis logic
const result = await performCustomAnalysis(sessionId, parameters);
res.json({ success: true, data: result });
} catch (error) {
res.status(500).json({ error: error.message });
}
});
API Best Practices
- Input Validation: Use Zod schemas for request validation
- Error Handling: Consistent error response format
- Authentication: Verify user sessions for protected endpoints
- Rate Limiting: Implement rate limiting for resource-intensive operations
- Documentation: Use JSDoc comments for auto-generated documentation
Deployment & Production
🚀 Build Process
# Development
npm run dev
# Production build
npm run build
# Database migrations
npm run db:push
# Type checking
npm run check
📦 Environment Configuration
# Required environment variables
DATABASE_URL=postgresql://...
REDIS_URL=redis://...
ANTHROPIC_API_KEY=...
JWT_SECRET=...
NODE_ENV=production
Production Checklist
- ✅ Configure production database
- ✅ Set up Redis for caching and sessions
- ✅ Configure external API keys securely
- ✅ Enable SSL/TLS certificates
- ✅ Set up monitoring and logging
- ✅ Configure backup strategies
- ✅ Test failover procedures