[package]
name = "server"
version = "0.1.0"
edition = "2024"
authors = ["Rustelo Contributors"]
license = "MIT"
description = "A modular Rust web application template built with Leptos, Axum, and optional components"
documentation = "https://docs.rs/server"
repository = "https://github.com/yourusername/rustelo"
homepage = "https://rustelo.dev"
readme = "../../README.md"
keywords = ["rust", "web", "leptos", "axum", "template"]
categories = ["web-programming", "template-engine"]

[lib]
crate-type = ["cdylib", "lib"]

[dependencies]
leptos = { workspace = true, features = ["ssr"] }
leptos_router = { workspace = true }
leptos_axum = { workspace = true }
leptos_config = { workspace = true }
leptos_meta = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
shared = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
toml = { workspace = true }
fluent = { workspace = true }
fluent-bundle = { workspace = true }
unic-langid = { workspace = true }

client = { path = "../client" }
axum = { version = "0.8"}
tokio = { version = "1", features = ["rt-multi-thread"]}
tower = { version = "0.5.2"}
tower-http = { version = "0.6.6", features = ["fs"]}
dotenvy = "0.15"
thiserror = "2.0.12"
regex = { workspace = true }
rand = "0.9.1"
gloo-timers = "0.3"
async-trait = "0.1"
anyhow = "1.0"
hex = "0.4"
reqwest = { version = "0.12", features = ["json"] }
rhai = { version = "1.22", features = ["serde", "only_i64", "no_float"] }

# Email support
lettre = { version = "0.11", features = ["tokio1-native-tls", "smtp-transport", "pool", "hostname", "builder"], optional = true }
handlebars = { version = "6.3", optional = true }
urlencoding = { version = "2.1", optional = true }

# TLS Support (optional)
axum-server = { version = "0.7", features = ["tls-rustls"], optional = true }
rustls = { version = "0.23", optional = true }
rustls-pemfile = { version = "2.2", optional = true }

# Authentication & Authorization (optional)
jsonwebtoken = { version = "9.3", optional = true }
argon2 = { version = "0.5", optional = true }
uuid = { version = "1.17", features = ["v4", "serde", "js"], optional = true }
chrono = { version = "0.4", features = ["serde"], optional = true }
oauth2 = { version = "5.0", optional = true }
tower-sessions = { version = "0.14", optional = true }
sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "postgres", "sqlite", "chrono", "uuid", "migrate"], optional = true }
tower-cookies = { version = "0.11", optional = true }
time = { version = "0.3.41", features = ["serde"], optional = true }

# 2FA Support (optional)
totp-rs = { version = "5.7.0", optional = true }
qrcode = { version = "0.14", features = ["svg"], optional = true }
base32 = { version = "0.5", optional = true }
sha2 = { version = "0.10", optional = true }
base64 = { version = "0.22", optional = true }

# Cryptography dependencies
aes-gcm = { version = "0.10", optional = true }
clap = { version = "4.5", features = ["derive"] }

# Metrics dependencies
prometheus = { version = "0.14", optional = true }

# Content Management & Rendering (optional)
pulldown-cmark = { version = "0.13.0", features = ["simd"], optional = true }
syntect = { version = "5.2", optional = true }
serde_yaml = { version = "0.9", optional = true }
tempfile = { version = "3.20", optional = true }
tera = { version = "1.20", optional = true }

# Binary targets
[[bin]]
name = "server"
path = "src/main.rs"

[[bin]]
name = "config_tool"
path = "src/bin/config_tool.rs"

[[bin]]
name = "crypto_tool"
path = "src/bin/crypto_tool.rs"
required-features = ["crypto"]

[[bin]]
name = "config_crypto_tool"
path = "src/bin/config_crypto_tool.rs"
required-features = ["crypto"]

[[bin]]
name = "test_config"
path = "src/bin/test_config.rs"

[[bin]]
name = "test_database"
path = "src/bin/test_database.rs"
required-features = ["auth"]

[[bin]]
name = "db_tool"
path = "src/bin/db_tool.rs"
required-features = ["auth"]

[dev-dependencies]
tempfile = "3.20"

[features]
default = []
hydrate = []
ssr = []
rbac = [
    "auth"
]

# Optional features
tls = ["axum-server/tls-rustls", "rustls", "rustls-pemfile"]
auth = [
    "jsonwebtoken",
    "argon2",
    "aes-gcm",
    "uuid",
    "chrono",
    "oauth2",
    "tower-sessions",
    "sqlx",
    "totp-rs",
    "qrcode",
    "base32",
    "sha2",
    "base64",
    "tower-cookies",
    "time",
    "crypto"
]
crypto = ["aes-gcm", "chrono", "base64", "time"]
content-db = [
    "sqlx",
    "pulldown-cmark",
    "syntect",
    "serde_yaml",
    "tempfile",
    "uuid",
    "chrono",
    "tera"
]
email = [
    "lettre",
    "handlebars",
    "urlencoding"
]
metrics = ["prometheus", "chrono"]
examples = []
production = ["auth", "content-db", "crypto", "email", "metrics", "tls"]

[package.metadata.docs.rs]
# Configuration for docs.rs
all-features = true
rustdoc-args = ["--cfg", "docsrs"]


# [features]
# hydrate = ["leptos/hydrate"]
# ssr = [
#   "axum",
#   "tokio",
#   "tower",
#   "tower-http",
#   "leptos_axum",
#   "leptos/ssr",
#   "leptos_meta/ssr",
#   "leptos_router/ssr",
# #  "dep:tracing",
# ]

# [package.metadata.cargo-all-features]
# denylist = ["axum", "tokio", "tower", "tower-http", "leptos_axum"]
# skip_feature_sets = [["ssr", "hydrate"], []]
