6.2 KiB
6.2 KiB
Lumina Development Guide
Prerequisites
- Node.js 20+
- pnpm 8+
- Docker & Docker Compose (for local development)
- Git
Quick Start with Docker
The easiest way to get started is using Docker Compose:
# Clone the repository
git clone <repository-url>
cd lumina
# Start all services
docker-compose up
# Access the application
# UI: http://localhost:9001
# API: http://localhost:3000
# MongoDB: localhost:27087
# Elasticsearch: localhost:9201
Manual Setup
1. Install Dependencies
# API
cd api
npm install
# UI
cd ui
pnpm install
2. Configure Environment Variables
# API
cp api/.env.example api/.env
# Edit api/.env with your configuration
# UI
cp ui/.env.example ui/.env
# Edit ui/.env with your configuration
3. Start Services
Option A: Using Docker for databases only
# Start MongoDB and Elasticsearch
docker-compose up mongodb mongodb-archive elasticsearch
Option B: Install locally
MongoDB:
# Install MongoDB 7.0
brew install mongodb-community@7.0 # macOS
# or use your package manager
# Start MongoDB
mongod --port 27087 --dbpath /path/to/data
mongod --port 40217 --dbpath /path/to/archive
Elasticsearch:
# Install Elasticsearch 8.11
brew install elasticsearch@8 # macOS
# Configure single-node mode
# Edit /usr/local/etc/elasticsearch/elasticsearch.yml:
# discovery.type: single-node
# xpack.security.enabled: false
# Start Elasticsearch
elasticsearch
4. Start Application
# Terminal 1: API Server
cd api
npm start
# Terminal 2: UI Dev Server
cd ui
pnpm dev-server
5. Access Application
- UI: http://localhost:9001
- API: http://localhost:3000
- 3D View: http://localhost:9001/graph/3d/public
Development Workflow
Running Tests
# API tests
cd api
npm test
# UI tests
cd ui
pnpm test
# E2E tests
npx playwright test
# Watch mode
npm test -- --watch
Linting
# API
cd api
npm run lint
# UI
cd ui
pnpm lint
Building
# UI production build
cd ui
pnpm build
# Output: ui/public/
Project Structure
lumina/
├── api/ # Backend API
│ ├── api/ # Routes and middleware
│ ├── business-logic/ # Core logic
│ ├── connectors/ # Database connectors
│ ├── utils/ # Utilities
│ └── __tests__/ # Tests
├── ui/ # Frontend
│ ├── views/ # React components
│ ├── business-logic/ # Frontend logic
│ ├── models/ # Data models
│ └── __tests__/ # Tests
├── e2e/ # E2E tests
├── docker/ # Docker configs
└── .github/workflows/ # CI/CD
Key Features
3D Visualization
Located in ui/views/graph/:
three-galaxy-view.js- Main 3D scenestore.js- Zustand state managementuse-stellar-stream.js- SSE connectionthree-galaxy-overlay.js- UI overlay
Real-Time Streaming
- API Endpoint:
/explorer/:network/tx/stream - Implementation:
api/business-logic/archive/tx-stream.js - Frontend Hook:
ui/views/graph/use-stellar-stream.js
AI Integration
- OpenRouter Client:
ui/business-logic/ai/openrouter-client.js - Pattern Analyzer:
ui/business-logic/ai/transaction-pattern-analyzer.js - Smart Search:
ui/business-logic/ai/smart-search.js
Configuration
API Configuration
Edit api/app.config.json:
{
"port": 3000,
"networks": {
"public": {
"db": "mongodb://...",
"horizon": "https://horizon.stellar.org"
}
}
}
Environment Variables
See .env.example files for all available options.
Required:
MONGODB_URI- MongoDB connection stringELASTICSEARCH_URL- Elasticsearch URLREACT_APP_API_ENDPOINT- API server URL
Optional:
REACT_APP_OPENROUTER_API_KEY- For AI featuresSENTRY_DSN- For error trackingGITHUB_OAUTH_CLIENT_ID- For directory management
Troubleshooting
MongoDB Connection Issues
# Check MongoDB is running
mongosh --port 27087
# Check connection string in .env
MONGODB_URI=mongodb://127.0.0.1:27087/se_pub802
Elasticsearch Issues
# Check Elasticsearch is running
curl http://localhost:9201/_cluster/health
# Check logs
docker logs lumina-elasticsearch
SSE Connection Issues
- Check API server is running
- Check CORS configuration in
api/.env - Check browser console for errors
- Verify network in URL matches configuration
3D Rendering Issues
- Check WebGL support: https://get.webgl.org/
- Check browser console for Three.js errors
- Try reducing
REACT_APP_3D_MAX_PARTICLES - Disable hardware acceleration if needed
Performance Tips
Development
- Use
API_CACHE_DISABLED=falsefor faster responses - Reduce
REACT_APP_3D_MAX_PARTICLESfor better FPS - Use Chrome DevTools Performance tab
Production
- Enable caching:
API_CACHE_DISABLED=false - Use CDN for static assets
- Enable gzip compression
- Use production build:
pnpm build
Debugging
API Debugging
# Verbose logging
MODE=development npm start
# Debug mode
NODE_ENV=development DEBUG=* npm start
UI Debugging
# React DevTools
# Install: https://react.dev/learn/react-developer-tools
# Redux DevTools (for Zustand)
# Install: https://github.com/reduxjs/redux-devtools
3D Debugging
// In browser console
window.__THREE_DEVTOOLS__ = true
// Access store
const store = require('./views/graph/store').useStore.getState()
console.log(store.transactions)
Contributing
- Create feature branch:
git checkout -b feature/my-feature - Make changes
- Run tests:
npm test - Run linter:
npm run lint - Commit:
git commit -m "Add feature" - Push:
git push origin feature/my-feature - Create Pull Request
Resources
Support
- GitHub Issues: /issues
- Documentation: See
DOCUMENTATION.md - Architecture: See
ARCHITECTURE.md