Expand description
§hydra-gateway
REST API and WebSocket gateway for the hydra-amm universal AMM engine.
This crate provides an HTTP and WebSocket interface for creating, managing,
and interacting with any supported AMM pool type. All AMM mathematics are
delegated to hydra-amm — this service is a coordination layer.
§Architecture
Clients (HTTP, WebSocket)
│
├── REST Handlers (api/)
├── WS Handler (ws/)
│
├── PoolService (service/)
├── EventBus (domain/)
│
├── PoolRegistry (domain/)
├── hydra-amm (PoolBox)
│
└── PostgreSQL PersistenceModules§
- api
- REST API layer: route handlers, DTOs, and router composition.
- app_
state - Shared application state injected into all Axum handlers.
- config
- Gateway configuration loaded from environment variables.
- domain
- Domain layer: core types, pool registry, and event system.
- error
- Gateway error types with HTTP status code mapping.
- persistence
- Persistence layer: PostgreSQL event log and pool snapshots.
- service
- Service layer: business logic orchestration.
- ws
- WebSocket layer: connection handling, message routing, subscriptions.