[package]
name = "socle"
version = "2.3.0"
edition = "2024"
authors = ["Gregoire Salingue"]
description = "Opinionated axum service bootstrap: telemetry, database, rate limiting, and shutdown in one builder"
license = "MIT"
repository = "https://github.com/brefwiz/socle"
readme = "README.md"
keywords = ["axum", "tower", "bootstrap", "http", "telemetry"]
categories = ["web-programming::http-server", "asynchronous"]
rust-version = "1.85"

[package.metadata.docs.rs]
# utoipa-swagger-ui downloads assets at build time — blocked by docs.rs sandbox.
# Build docs without the openapi feature to avoid that network dependency.
features = ["telemetry", "database", "ratelimit-memory", "dotenv", "validation", "cursor", "testing"]
no-default-features = true

[features]
default = ["telemetry", "database", "ratelimit-memory", "openapi", "dotenv"]

dotenv = ["dep:dotenvy"]

telemetry = []

database = ["dep:sqlx"]

ratelimit = []
ratelimit-memory = ["ratelimit", "dep:governor"]

openapi = ["dep:utoipa", "dep:utoipa-swagger-ui"]

validation = ["dep:validator"]

cursor = ["api-bones/base64"]

testing = ["dep:reqwest"]
http-client = ["dep:reqwest", "dep:reqwest-middleware", "dep:opentelemetry", "dep:async-trait", "dep:http"]
metrics = ["dep:opentelemetry", "dep:opentelemetry_sdk", "dep:opentelemetry-prometheus", "dep:prometheus"]
testing-postgres = ["dep:testcontainers", "dep:testcontainers-modules", "dep:sqlx"]

[dependencies]
axum = { version = "0.8", features = ["macros"] }
tokio = { version = "1", features = ["full"] }
tower = { version = "0.5", features = ["util"] }
tower-http = { version = "0.6", features = ["trace", "cors", "catch-panic", "compression-full", "request-id", "util", "limit"] }
uuid = { version = "1", features = ["v7", "v5"] }
futures-util = "0.3"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
thiserror = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
figment = { version = "0.10", features = ["env", "toml"] }
chrono = { version = "0.4", features = ["serde"] }

api-bones = { version = "4.0.1", features = ["axum", "uuid"] }

sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio-rustls", "postgres", "migrate"], optional = true }

governor = { version = "0.10", default-features = false, features = ["std", "dashmap"], optional = true }

utoipa = { version = "5", optional = true }
utoipa-swagger-ui = { version = "9", default-features = false, features = ["axum"], optional = true }

dotenvy = { version = "0.15", optional = true }

reqwest = { version = "0.13", default-features = false, features = ["json", "rustls"], optional = true }
reqwest-middleware = { version = "0.5", optional = true }
opentelemetry = { version = "0.31", optional = true }
async-trait = { version = "0.1", optional = true }
http = { version = "1", optional = true }
opentelemetry_sdk = { version = "0.31", default-features = false, features = ["metrics"], optional = true }
opentelemetry-prometheus = { version = "0.31", optional = true }
prometheus = { version = "0.14", default-features = false, optional = true }

validator = { version = "0.20", features = ["derive"], optional = true }

testcontainers = { version = "0.27", optional = true }
testcontainers-modules = { version = "0.15", features = ["postgres"], optional = true }

[dev-dependencies]
tokio = { version = "1", features = ["full", "test-util"] }
reqwest = { version = "0.13", default-features = false, features = ["json", "rustls"] }
serde_json = "1"
http-body-util = "0.1"
bytes = "1"
tempfile = "3"
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio-rustls", "postgres"] }
opentelemetry_sdk = { version = "0.31", features = ["trace"] }

[[example]]
name = "minimal"
path = "examples/minimal.rs"
required-features = ["telemetry"]

[[example]]
name = "with_database"
path = "examples/with_database.rs"
required-features = ["telemetry", "database"]

[[example]]
name = "with_ratelimit"
path = "examples/with_ratelimit.rs"
required-features = ["telemetry", "ratelimit-memory"]

[[test]]
name = "integration"
path = "tests/integration.rs"
required-features = ["testing"]
