Skip to content

Crates and feature flags

The workspace is split into focused crates. Most applications depend on the elura facade and enable concrete features there.

Workspace crates

CratePurposePublished application dependency?
eluraUnified facade and feature selectionYes, recommended
elura-coreProtocol, sessions, routing, tickets, realtime primitivesFor low-level integrations
elura-runtimeLifecycle, security, administration, and observabilityUsually through elura
elura-gatewayClient connection and session runtimeUsually through elura
elura-worldCommand and player-state runtimeUsually through elura
elura-roomApplication-owned room roster and lifecycleUsually through elura
elura-aoiSparse-grid two-dimensional visibility indexingUsually through elura
elura-simulationDeterministic fixed-step timingUsually through elura
elura-netcodeTick sync, input redundancy, prediction, and interpolationUsually through elura
elura-replicationPer-observer entity lifecycle and state replicationUsually through elura
elura-lag-compensationBounded authoritative history and rewind queriesUsually through elura
elura-net-simDeterministic adverse-network simulationDevelopment and tests
elura-monolithSingle-process Gateway and World compositionUsually through elura
elura-testkitTransport-selectable full-stack business and load testsDevelopment dependency
elura-adaptersRedis, SQL, DNS, Kubernetes, outbox adaptersUsually through elura
elura-providersIdentity, OTP, SMS, payment providersUsually through elura
elura-cliProject scaffolding binaryInstall as a tool
elura-loadTransport-selectable framework regression load generatorFramework maintainers only; publish = false
elura-perfReproducible multi-Gateway regression environmentFramework maintainers only; publish = false

Facade features

The elura crate enables gateway and world by default. Both include runtime, and runtime includes core.

FeatureEnables
coreelura-core
runtimecore, elura-runtime
gatewayruntime, elura-gateway
worldruntime, elura-world
monolithgateway, world, elura-monolith
roomelura-room
aoielura-aoi
simulationelura-simulation
netcodeelura-netcode
replicationelura-replication; it uses elura-netcode internally
lag-compensationelura-lag-compensation
net-simelura-net-sim
adaptersruntime, base elura-adapters
redisadapters, gateway, world, Redis adapter implementations
sqladapters, SQL adapter implementations
kubernetesadapters, gateway, Kubernetes adapter implementations
adminadapters, adapter-backed admin capabilities
providerscore, base elura-providers
identityidentity provider set; also enables the Gateway HTTP identity bridge when gateway is enabled
notification-alismsAliyun SMS notification provider
otpOTP service and store integration
payment-alipayAlipay
payment-appleApple purchase verification
payment-douyinDouyin payment
payment-quicksdkQuickSDK payment
payment-wechat-miniWeChat Mini Program payment
payment-wechat-payWeChat Pay
fullAll optional gameplay primitives, adapters, and providers above

Facade imports

The facade keeps its crate root intentionally small: elura::Error and elura::Result are available there, while the rest of the API is organized by responsibility.

Use the prelude for common application contracts and runtime types:

rust
use elura::prelude::{
    AdminServerConfig, Gateway, GatewayConfig, Identity, OnlineBackend,
    OnlineDirectory, OnlineStatsReader, Route, SessionEvent, SessionObserver,
    TcpConfig, TcpTransport, World, WorldConfig, WorldContext,
};

The online contracts are in the prelude; concrete backends remain explicit:

rust
use elura::adapters::online::RedisOnlineDirectory; // `redis`

Use domain modules when the responsibility should remain visible at the call site:

rust
use elura::world::{World, WorldModule, WorldModuleRegistry};
use elura::world::middleware::LoggingMiddleware;
use elura::world::testing::{test_identity, WorldHarness, WorldTestClient};
use elura_testkit::{FullStackBuilder, FullStackLoadConfig};
use elura::gateway::GatewayInfrastructure;
use elura::{aoi, lag_compensation, netcode, replication, room, simulation};

Concrete infrastructure and provider implementations are never added to the prelude. Import them through their feature-gated namespaces:

rust
use elura::adapters::discovery::{DnsWorldDiscovery, DnsWorldDiscoveryConfig};
use elura::adapters::replay::RedisReplayStore; // `redis`
use elura::providers::identity::GuestProvider; // `identity`
use elura::providers::payment::WechatPayPayment; // `payment-wechat-pay`

With gateway and identity enabled, the prelude also exports IdentityHttpBackend and IdentityHttpPolicy. HttpAuthApi, HttpBearerAuth, AuthenticatedHttp, and the HTTP token types are available with the normal gateway/core features.

This split makes dependencies on Redis, Kubernetes, SQL, or third-party APIs easy to see during review. Feature flags still determine whether a module or item is available. Provider operations use elura::providers::ProviderResult; common provider traits are also available from the prelude when their feature is enabled.

Examples

toml
# Gateway + World runtime only (default)
elura = "0.3.1"

# DNS discovery types live in the adapter crate without a concrete optional
# backend, so the generated split project starts with this feature.
elura = { version = "0.3.1", features = ["adapters"] }

# Redis-backed distributed application
elura = { version = "0.3.1", features = ["redis"] }

# Kubernetes discovery and SQL account versions
elura = { version = "0.3.1", features = ["kubernetes", "sql"] }

# Authoritative realtime gameplay primitives
elura = { version = "0.3.1", features = [
  "room", "aoi", "simulation", "netcode", "replication",
  "lag-compensation",
] }

The CLI writes its exact Elura release into generated manifests. Keep the CLI and facade crate on the same release so generated source matches the imported API.

Rustdoc

Use docs.rs for item-level signatures and this site for architecture and operational guidance:

  • https://docs.rs/elura
  • https://docs.rs/elura-core
  • https://docs.rs/elura-runtime
  • https://docs.rs/elura-adapters
  • https://docs.rs/elura-providers
  • https://docs.rs/elura-room
  • https://docs.rs/elura-aoi
  • https://docs.rs/elura-simulation
  • https://docs.rs/elura-netcode
  • https://docs.rs/elura-replication
  • https://docs.rs/elura-lag-compensation
  • https://docs.rs/elura-net-sim

Released under the MIT License.