
[package]
name = "rustelo_server"
version = "0.1.0"
edition = "2021"
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://jesusperez.pro"
readme = "../../README.md"
keywords = [
    "rust",
    "web",
    "leptos",
    "axum",
    "template",
]
categories = [
    "web-programming",
    "template-engine",
]

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

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

[dependencies]
html-escape = { workspace = true }
leptos_config = { workspace = true, optional = true }
leptos = { workspace = true, features = ["ssr"], optional = true }
leptos_router = { workspace = true, features = ["ssr"], optional = true }
leptos_axum = { workspace = true, optional = true }
leptos_meta = { workspace = true, optional = true }
any_spawner = { workspace = true, optional = true }
serde = { workspace = true }
serde_json = { 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 }

# Template engine for the htmx-ssr profile (`kind = "template"` routes).
minijinja = { version = "2", default-features = false, features = ["builtins", "loader", "json", "multi_template", "serde"] }
minijinja-autoreload = { version = "2", optional = true }
url = "2"

rustelo_core_types = { workspace = true }
rustelo_core_lib = { workspace = true, features = ["manifest"] }
# Optional: pulled in only when the `hydrate` feature is enabled. Htmx-ssr-only
# sites skip the WASM client entirely by building with --no-default-features
# --features ssr,htmx-ssr.
rustelo_client = { workspace = true, optional = true }
rustelo_components_htmx = { workspace = true }
rustelo_pages_htmx = { workspace = true }
rustelo_components_leptos = { workspace = true, features = ["ssr"], optional = true }
rustelo_pages_leptos = { workspace = true, features = ["ssr"], optional = true }

axum = { workspace = true, features = ["ws"] }
tokio = { workspace = true, features = ["rt-multi-thread", "process"]}
tokio-stream = { workspace = true }
tokio-util = { workspace = true }
tower = { workspace = true }
# notify declared per-platform below
tower-http = { workspace = true, features = ["fs", "cors", "trace"]}
dotenv = { workspace = true }
thiserror = { workspace = true }
regex = { workspace = true }
rand = { workspace = true }
dashmap = { workspace = true }
async-trait = { workspace = true }
anyhow = { workspace = true }
glob = { workspace = true }
rustelo_config = { workspace = true }
hex = { workspace = true }
reqwest = { workspace = true, features = ["json"] }
rhai = { workspace = true, features = ["serde", "only_i64", "no_float"] }
futures = { workspace = true }

# Email support
lettre = { workspace = true, default-features = false, features = ["tokio1-rustls-tls", "smtp-transport", "pool", "hostname", "builder"], optional = true }

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

# Authentication & Authorization (optional)
jsonwebtoken = { workspace = true, optional = true }
argon2 = { workspace = true, optional = true }
uuid = { workspace = true, features = ["v4", "serde", "js"], optional = true }
chrono = { workspace = true, features = ["serde"] }
oauth2 = { workspace = true, optional = true }
tower-sessions = { workspace = true, optional = true }
sqlx = { workspace = true, features = ["runtime-tokio", "tls-rustls-ring", "postgres", "sqlite", "chrono", "uuid", "migrate"], optional = true }
tower-cookies = { workspace = true, optional = true }
time = { workspace = true, features = ["serde"], optional = true }

# 2FA Support (optional)
totp-rs = { workspace = true, optional = true }
qrcode = { workspace = true, features = ["svg"], optional = true }
base32 = { workspace = true, optional = true }
sha2 = { workspace = true }
base64 = { workspace = true, optional = true }

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

# Metrics dependencies
prometheus = { workspace = true, optional = true }

# NATS admin client (optional)
async-nats = { workspace = true, optional = true }
platform-nats = { workspace = true }
nkeys = { workspace = true }
bytes = { workspace = true }

# Content Management & Rendering (optional)
pulldown-cmark = { workspace = true, features = ["simd"], optional = true }
serde_yaml = { workspace = true, optional = true }
tempfile = { workspace = true, optional = true }
tera = { workspace = true, optional = true }
async-compression = { workspace = true, features = ["gzip", "tokio"], optional = true }
lru = { workspace = true, optional = true }
ammonia = { workspace = true, optional = true }
scraper = { workspace = true, optional = true }

[target.'cfg(target_os = "macos")'.dependencies]
notify = { workspace = true, features = ["macos_fsevent"], optional = true }

[target.'cfg(not(target_os = "macos"))'.dependencies]
notify = { workspace = true, optional = true }

[dev-dependencies]
tempfile = { workspace = true }
argon2 = { workspace = true }
rand_core = { workspace = true }
axum-test = { workspace = true }
futures = { workspace = true }

[features]
# `hydrate` is enabled by default to preserve back-compat with sites built
# before ADR-006: the WASM client (rustelo_client) is pulled and the shell
# emits hydration scripts. Sites that fully adopt the htmx-ssr profile build
# with `--no-default-features --features ssr,htmx-ssr` to skip rustelo_client.
default = ["hydrate", "leptos-hydration"]
hydrate = ["dep:rustelo_client"]
ssr = []
# Leptos SSR/hydration stack. Gate behind this feature for htmx-only builds.
# Enables: leptos, leptos_axum, leptos_meta, any_spawner, rustelo_components_leptos,
# rustelo_pages_leptos. Not needed when the site exclusively uses the htmx-ssr profile.
leptos-hydration = [
    "dep:leptos",
    "dep:leptos_router",
    "dep:leptos_axum",
    "dep:leptos_meta",
    "dep:leptos_config",
    "dep:any_spawner",
    "dep:rustelo_components_leptos",
    "dep:rustelo_pages_leptos",
    "rustelo_core_lib/leptos-hydration",
]
# Enables filesystem watcher for minijinja templates (dev only).
template-autoreload = ["minijinja-autoreload"]
htmx-ssr = []
# Per-post engagement surface (views/ratings/messages) for htmx-ssr sites.
# Self-sufficient: pulls the DB deps it needs so it compiles without `auth`.
post-engagement = ["uuid", "sqlx"]
rbac = ["auth"]
rbac-watcher = ["rbac", "notify"]
nats-admin = ["async-nats"]
pipeline-watcher = ["nats-admin", "notify"]
tls = [
    "axum-server/tls-rustls",
    "rustls",
    "rustls-pemfile",
]
auth = [
    "jsonwebtoken",
    "argon2",
    "aes-gcm",
    "uuid",
    "oauth2",
    "tower-sessions",
    "sqlx",
    "totp-rs",
    "qrcode",
    "base32",
    "base64",
    "tower-cookies",
    "time",
    "crypto",
]
crypto = [
    "aes-gcm",
    "base64",
    "time",
]
content-static = [
    "pulldown-cmark",
    "serde_yaml",
    "tempfile",
    "tera",
    "uuid",
    "async-compression",
    "lru",
    "ammonia",
    "scraper",
]
content-watcher = [
    "content-static",
    "notify",
]
content-db = [
    "content-static",
    "sqlx",
]
email = [
    "lettre",
    "tera",
]
metrics = [
    "prometheus",
]
examples = []
production = [
    "auth",
    "content-db",
    "content-static",
    "crypto",
    "email",
    "metrics",
    "tls",
]

[[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 = "content_processor"
path = "src/bin/content_processor.rs"
required-features = ["content-static"]

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