Technology Stack
Nexgent is built with a modern TypeScript stack optimized for real-time trading operations.
Core Technologies
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Runtime | Node.js | 18+ | Server runtime |
| Language | TypeScript | 5.7 | Type-safe development |
| Package Manager | pnpm | 8+ | Workspace management |
Backend Stack
Web Framework
| Technology | Purpose |
|---|---|
| Express | HTTP server and REST API routing |
| ws | WebSocket server for real-time updates |
| cors | Cross-origin resource sharing |
Database & ORM
| Technology | Purpose |
|---|---|
| PostgreSQL | Primary database for persistent storage |
| Prisma | Type-safe ORM with migrations |
Prisma generates TypeScript types from the database schema, ensuring type safety from database to API responses.
Caching
| Technology | Purpose |
|---|---|
| Redis | In-memory caching and pub/sub |
| ioredis | Redis client with cluster support |
Redis is used for:
- Balance caching (write-through)
- Position caching (write-through)
- Price caching (TTL-based)
- Agent configuration caching
- Idempotency keys (preventing duplicate trades)
- Rate limiting state
Job Queue
| Technology | Purpose |
|---|---|
| BullMQ | Background job processing |
BullMQ handles:
- Async database writes (historical swaps)
- Scheduled balance snapshots
- Retry logic for failed operations
Authentication
| Technology | Purpose |
|---|---|
| jsonwebtoken | JWT token generation and verification |
| bcrypt | Password hashing |
Validation
| Technology | Purpose |
|---|---|
| Zod | Runtime schema validation |
Logging & Monitoring
| Technology | Purpose |
|---|---|
| Pino | Structured JSON logging |
| prom-client | Prometheus metrics |
Development
| Technology | Purpose |
|---|---|
| tsx | TypeScript execution with watch mode |
| Jest | Unit and integration testing |
| Supertest | HTTP assertion testing |
Frontend Stack
Framework
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 15 | React framework with App Router |
| React | 18 | UI library |
State Management
| Technology | Purpose |
|---|---|
| TanStack React Query | Server state management, caching, and synchronization |
| React Context | Client state (user, agent selection, currency) |
| WebSocket | Real-time position and price updates |
💡
React Query handles all API data fetching with automatic caching, background refetching, and optimistic updates. WebSocket updates are merged into React Query cache for consistency.
UI Components
| Technology | Purpose |
|---|---|
| shadcn/ui | Component library (Radix UI primitives) |
| Tailwind CSS | Utility-first styling |
| Lucide React | Icon library |
| Recharts | Charting library |
Forms
| Technology | Purpose |
|---|---|
| React Hook Form | Form state management |
| @hookform/resolvers | Zod integration for validation |
Authentication
| Technology | Purpose |
|---|---|
| NextAuth.js | Authentication framework |
| jwt-decode | Client-side token decoding |
Blockchain Integrations
Solana
| Technology | Purpose |
|---|---|
| @solana/web3.js | Solana blockchain interaction |
| bs58 | Base58 encoding for keys |
Trading
| Integration | Purpose |
|---|---|
| Jupiter Aggregator | DEX aggregation for optimal swap routing |
| Pyth Network | SOL/USD price oracle |
| DexScreener | Token price feeds and liquidity data |
⚠️
Jupiter API requires an API key for production use. Rate limits apply to all external APIs.
Infrastructure
Containerization
| Technology | Purpose |
|---|---|
| Docker | Container runtime |
| Docker Compose | Multi-container orchestration |
Deployment
| Platform | Purpose |
|---|---|
| Railway | Recommended hosting platform |
The railway.json configures:
- Backend service
- Frontend service
- PostgreSQL database
- Redis instance
Development Tools
Code Quality
| Tool | Purpose |
|---|---|
| ESLint | Code linting |
| TypeScript | Static type checking |
| Prettier | Code formatting |
Testing
| Tool | Purpose |
|---|---|
| Jest | Test runner |
| ts-jest | TypeScript support for Jest |
| Supertest | HTTP integration testing |
Version Requirements
{
"engines": {
"node": ">=18.0.0",
"pnpm": ">=8.0.0"
}
}Key Dependencies by Package
nexgent-open-source-trading-engine/backend
@prisma/client ^5.22.0 Database ORM
@solana/web3.js ^1.87.0 Blockchain interaction
bullmq ^5.65.0 Job queue
express ^4.18.2 Web framework
ioredis ^5.3.2 Redis client
jsonwebtoken ^9.0.2 JWT handling
pino ^8.17.2 Logging
ws ^8.16.0 WebSocket server
zod ^3.25.76 Validationnexgent-open-source-trading-engine/frontend
next ^15.5.9 React framework
react ^18.2.0 UI library
@tanstack/react-query ^5.90.7 Server state
next-auth ^4.24.7 Authentication
recharts ^3.4.1 Charts
tailwindcss ^3.4.1 Styling
zod ^3.25.76 Validationnexgent-open-source-trading-engine/shared
zod ^3.25.76 Schema validation