[package]
name = "nestrs"
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
repository.workspace = true
homepage.workspace = true
readme = "README.md"
description = "NestJS-like API framework for Rust on top of Axum and Tower."
keywords = ["axum", "tower", "nest", "di", "web"]
categories = ["web-programming", "asynchronous", "network-programming"]

[features]
default = []
microservices = ["dep:nestrs-microservices", "dep:nestrs-events"]
microservices-nats = ["microservices", "nestrs-microservices/nats", "dep:async-nats"]
microservices-redis = ["microservices", "nestrs-microservices/redis", "dep:redis"]
microservices-grpc = ["microservices", "nestrs-microservices/grpc"]
microservices-kafka = ["microservices", "nestrs-microservices/kafka"]
microservices-mqtt = ["microservices", "nestrs-microservices/mqtt"]
microservices-rabbitmq = ["microservices", "nestrs-microservices/rabbitmq"]
microservices-metrics = ["microservices", "nestrs-microservices/microservice-metrics"]
ws = ["dep:nestrs-ws"]
graphql = ["dep:nestrs-graphql"]
openapi = ["dep:nestrs-openapi"]
cache-redis = ["dep:redis"]
schedule = ["dep:tokio-cron-scheduler", "dep:linkme"]
queues = ["dep:linkme"]
queues-redis = ["queues", "dep:redis"]
database-sqlx = ["dep:sqlx"]
mongo = ["dep:mongodb"]
http-client = ["dep:reqwest"]
cookies = ["dep:tower-cookies"]
csrf = ["cookies", "dep:subtle"]
session = ["cookies", "dep:tower-sessions"]
mvc = ["dep:minijinja"]
files = ["dep:tokio-util"]
otel = [
  "dep:opentelemetry",
  "dep:opentelemetry_sdk",
  "dep:opentelemetry-otlp",
  "dep:tracing-opentelemetry",
]
## Clears `nestrs-core` global registries in tests (`RouteRegistry`, `MetadataRegistry`). See `STABILITY.md`.
test-hooks = ["nestrs-core/test-hooks"]

[dependencies]
axum = { workspace = true, features = ["multipart"] }
tokio.workspace = true
nestrs-core = { version = "0.2.0", path = "../nestrs-core" }
nestrs-macros = { version = "0.2.0", path = "../nestrs-macros" }
nestrs-microservices = { version = "0.2.0", path = "../nestrs-microservices", optional = true }
nestrs-events = { version = "0.2.0", path = "../nestrs-events", optional = true }
nestrs-ws = { version = "0.2.0", path = "../nestrs-ws", optional = true }
nestrs-graphql = { version = "0.2.0", path = "../nestrs-graphql", optional = true }
nestrs-openapi = { version = "0.2.0", path = "../nestrs-openapi", optional = true }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
validator = { version = "0.20", features = ["derive"] }
tower = { version = "0.5", features = ["limit", "load-shed"] }
tower-http = { version = "0.6", features = ["cors", "set-header", "limit", "request-id", "compression-gzip", "decompression-gzip", "normalize-path", "fs"] }
async-trait = "0.1"
metrics = "0.24"
# Recorder + render only; we expose `/metrics` via Axum (no built-in hyper listener / push gateway).
metrics-exporter-prometheus = { version = "0.18", default-features = false }
tracing = "=0.1.44"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt", "json"] }
dotenvy = "0.15.7"
envy = "0.4.2"
redis = { version = "0.29", features = ["tokio-comp"], optional = true }
async-nats = { version = "0.47", optional = true }
tokio-cron-scheduler = { version = "0.15.1", optional = true }
linkme = { version = "0.3", optional = true }
opentelemetry = { version = "0.31.0", features = ["trace"], optional = true }
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"], optional = true }
opentelemetry-otlp = { version = "0.31.1", default-features = false, features = ["trace", "grpc-tonic"], optional = true }
tracing-opentelemetry = { version = "0.32.1", default-features = false, optional = true }
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "tls-rustls-ring", "any", "postgres", "sqlite"], optional = true }
mongodb = { version = "3", optional = true }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"], optional = true }
tower-cookies = { version = "0.10", optional = true }
subtle = { version = "2.6", optional = true }
tower-sessions = { version = "0.10", default-features = false, features = ["memory-store"], optional = true }
minijinja = { version = "2", optional = true, default-features = false, features = ["serde"] }
tokio-util = { version = "0.7", features = ["io"], optional = true }

[dev-dependencies]
async-graphql = "=7.0.17"
flate2 = "1"
tower = { version = "0.5", features = ["util"] }
serial_test = "3"
criterion = { version = "0.5", features = ["async_tokio"] }
futures-util = "0.3"

[[bench]]
name = "router_hot_path"
harness = false

[[bench]]
name = "router_middleware_stack"
harness = false

[[bench]]
name = "di_resolution"
harness = false

[[bench]]
name = "json_validation_hot_path"
harness = false

[[test]]
name = "integration_matrix"
path = "tests/integration_matrix.rs"
required-features = ["openapi", "csrf", "test-hooks"]
