138 lines
3.8 KiB
Markdown
138 lines
3.8 KiB
Markdown
# Token Aggregation Service - Control Panel & Proxmox Deployment
|
|
|
|
## ✅ Complete Implementation
|
|
|
|
The Token Aggregation Service now includes a full-featured Control Panel and Proxmox deployment capabilities.
|
|
|
|
## Features
|
|
|
|
### Control Panel UI
|
|
- **Dashboard**: Real-time service statistics
|
|
- **API Key Management**: Add/edit/delete external API keys
|
|
- **Endpoint Management**: Configure RPC and API endpoints
|
|
- **DEX Factory Management**: Manage DEX factory addresses
|
|
- **Authentication**: Secure login with role-based access
|
|
|
|
### Admin API
|
|
- JWT authentication
|
|
- Role-based access control
|
|
- API key encryption
|
|
- Endpoint health checks
|
|
- Audit logging
|
|
|
|
### Proxmox Deployment
|
|
- Automated LXC container creation
|
|
- Service installation
|
|
- Frontend build and nginx setup
|
|
- Systemd service configuration
|
|
|
|
## Quick Start
|
|
|
|
### 1. Database Setup
|
|
```bash
|
|
# Run migrations
|
|
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0011_token_aggregation_schema.up.sql
|
|
psql $DATABASE_URL -f explorer-monorepo/backend/database/migrations/0012_admin_config_schema.up.sql
|
|
```
|
|
|
|
### 2. Deploy to Proxmox
|
|
```bash
|
|
cd smom-dbis-138/services/token-aggregation
|
|
./scripts/deploy-to-proxmox.sh
|
|
```
|
|
|
|
### 3. Create Admin User
|
|
```bash
|
|
./scripts/create-admin-user.sh
|
|
```
|
|
|
|
### 4. Access Control Panel
|
|
Navigate to `http://<container-ip>` and login.
|
|
|
|
## File Structure
|
|
|
|
```
|
|
token-aggregation/
|
|
├── src/ # Backend (22 TypeScript files)
|
|
│ ├── api/
|
|
│ │ ├── routes/
|
|
│ │ │ ├── tokens.ts # Public API
|
|
│ │ │ └── admin.ts # Admin API
|
|
│ │ └── middleware/ # Auth, cache, rate-limit
|
|
│ ├── database/
|
|
│ │ └── repositories/
|
|
│ │ └── admin-repo.ts
|
|
│ └── indexer/ # All indexers
|
|
├── frontend/ # Control Panel (12 files)
|
|
│ ├── src/
|
|
│ │ ├── pages/ # 5 pages (Dashboard, Login, ApiKeys, Endpoints, DexFactories)
|
|
│ │ ├── components/ # Layout, ProtectedRoute
|
|
│ │ ├── services/ # API client
|
|
│ │ └── stores/ # Auth store
|
|
│ └── Dockerfile # Frontend container
|
|
├── scripts/
|
|
│ ├── deploy-to-proxmox.sh
|
|
│ └── create-admin-user.sh
|
|
└── docker-compose.full.yml # Full stack
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Public API
|
|
- `GET /api/v1/chains`
|
|
- `GET /api/v1/tokens`
|
|
- `GET /api/v1/tokens/:address`
|
|
- `GET /api/v1/tokens/:address/pools`
|
|
- `GET /api/v1/tokens/:address/ohlcv`
|
|
- `GET /api/v1/tokens/:address/signals`
|
|
- `GET /api/v1/search`
|
|
- `GET /api/v1/pools/:poolAddress`
|
|
|
|
### Admin API (requires auth)
|
|
- `POST /api/v1/admin/auth/login`
|
|
- `GET /api/v1/admin/api-keys`
|
|
- `POST /api/v1/admin/api-keys`
|
|
- `PUT /api/v1/admin/api-keys/:id`
|
|
- `DELETE /api/v1/admin/api-keys/:id`
|
|
- `GET /api/v1/admin/endpoints`
|
|
- `POST /api/v1/admin/endpoints`
|
|
- `PUT /api/v1/admin/endpoints/:id`
|
|
- `GET /api/v1/admin/dex-factories`
|
|
- `POST /api/v1/admin/dex-factories`
|
|
- `GET /api/v1/admin/status`
|
|
- `GET /api/v1/admin/audit-log`
|
|
|
|
## Configuration via Control Panel
|
|
|
|
### Adding API Keys
|
|
1. Login to control panel
|
|
2. Navigate to "API Keys"
|
|
3. Click "Add API Key"
|
|
4. Select provider, enter key name and API key
|
|
5. Save
|
|
|
|
### Adding Endpoints
|
|
1. Navigate to "Endpoints"
|
|
2. Click "Add Endpoint"
|
|
3. Select chain, type, enter name and URL
|
|
4. Optionally set as primary
|
|
5. Save
|
|
|
|
### Adding DEX Factories
|
|
1. Navigate to "DEX Factories"
|
|
2. Click "Add Factory"
|
|
3. Select chain and DEX type
|
|
4. Enter factory address
|
|
5. Enter router/pool manager if applicable
|
|
6. Save
|
|
|
|
## Status
|
|
|
|
**Implementation**: ✅ 100% Complete
|
|
- Backend: ✅ Complete
|
|
- Frontend: ✅ Complete (5 pages, all components)
|
|
- Database: ✅ Complete (2 migrations)
|
|
- Deployment: ✅ Complete (Proxmox script ready)
|
|
|
|
**Ready for**: Production deployment to Proxmox VM
|