Files
foxhunt/services/api
jgrusewski e50ea55064 feat: create services/api/ — unified gRPC gateway with tonic-web
Copied from api_gateway, removed REST handlers (port 8080),
added tonic-web + CORS for grpc-web browser access.
Binary renamed: api-gateway → api

Changes:
- Package name: api-gateway → api
- Deleted src/handlers/ (REST ML endpoints on port 8080)
- Added tonic-web 0.13 + tower-http CORS layer
- Server::builder().accept_http1(true) for grpc-web
- CORS_ORIGINS env var (default http://localhost:5173)
- Metrics server on port 9091 (axum) preserved
- All 95 lib tests pass, 0 clippy warnings
- Added services/api to workspace members

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:32:46 +01:00
..

api

Foxhunt API Service -- unified gRPC gateway with tonic-web for browser access, 6-layer authentication, RBAC, rate limiting, and gRPC proxy routing.

Key Types

  • TradingServiceProxy -- main gRPC proxy implementation
  • RoleBasedAccessControl -- RBAC authorization
  • RateLimiter -- 3-tier rate limiting (auth/trading/compute)
  • CircuitBreaker -- upstream service protection

Configuration

  • JWT_SECRET -- JWT signing secret (min 32 chars)
  • CORS_ORIGINS -- comma-separated allowed origins for gRPC-Web (default: http://localhost:5173)
  • TRADING_SERVICE_URL -- trading service gRPC endpoint
  • ML_TRAINING_SERVICE_URL -- ML training service gRPC endpoint

Features

  • mfa (default) -- multi-factor authentication support
  • Build without: cargo check -p api --no-default-features --features minimal