# Empty workspace to make this template standalone
[workspace]

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

[package]
name = "server-template"
version = "0.1.0"
edition = "2021"
authors = ["Rustelo Contributors"]
license = "MIT OR Apache-2.0"
description = "Server-side template using trait-based dependency injection"
documentation = "https://docs.rs/rustelo"
repository = "https://github.com/rustelo/rustelo"
homepage = "https://rustelo.dev"
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]
# Pure trait dependencies from Layer 1
rustelo-routing-traits = { path = "../../traits/routing-traits"  }

rustelo-component-traits = {  path = "../../traits/component-traits"  }

rustelo-core-types = {  path = "../../traits/core-types"  }

# Core lib template
core-lib-template = { path = "../core-lib-template"  }

# Client template for SSR
client-template = { path = "../client-template"  }

# Essential Leptos dependencies
leptos = { workspace = true, features = ["ssr"]  }

leptos_meta = { workspace = true }

leptos_axum = { workspace = true }

leptos_config = { workspace = true }

# Axum web framework
axum = { workspace = true }

tower = { workspace = true }

tower-http = { workspace = true, features = ["fs", "cors", "trace"]  }

# Async runtime
tokio = { workspace = true, features = [ "rt-multi-thread", "macros", "process", "fs", "net", "time", "sync" ]  }

# Serialization
serde = { workspace = true, features = ["derive"] }

serde_json = { workspace = true }

# Logging
tracing = { workspace = true }

tracing-subscriber = { workspace = true, features = ["env-filter"] }

# Error handling
thiserror = { workspace = true }

anyhow = { workspace = true }

# Configuration
dotenvy = { workspace = true }

clap] = { workspace = true, features = ["derive"] }

# HTTP client
reqwest = { workspace = true, features = ["json"] }

# Async utilities
futures = { workspace = true }

async-trait = { workspace = true }

# Utilities
regex = { workspace = true }

rand = { workspace = true }

# Optional features
uuid = { workspace = true, features = ["v4", "serde"], optional = true }

chrono = { workspace = true, features = ["serde"], optional = true }

# TLS support
axum-server = { workspace = true, features = ["tls-rustls"], optional = true }

rustls = { workspace = true, optional = true }

rustls-pemfile = { workspace = true, optional = true }

# Authentication
jsonwebtoken = { workspace = true, optional = true }

argon2 = { workspace = true, optional = true }

tower-sessions = { workspace = true, optional = true }

tower-cookies = { workspace = true, optional = true }

# Database
# Content processing
pulldown-cmark = { workspace = true, features = ["simd"] , optional = true }

ammonia = { workspace = true , optional = true }


handlebars = { workspace = true, optional = true }

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

# Crypto
aes-gcm = { workspace = true, optional = true }

base64 = { workspace = true, optional = true }

sha2 = { workspace = true, optional = true }

[dependencies.sqlx]
version = "0.8"
features = [
    "runtime-tokio-rustls",
    "postgres",
    "sqlite",
    "chrono",
    "uuid",
    "migrate",
]
optional = true

# Email
[dependencies.lettre]
version = "0.11"
features = [
    "tokio1-native-tls",
    "smtp-transport",
    "pool",
    "hostname",
    "builder",
]
optional = true

# Development dependencies
[dev-dependencies]
tempfile = { workspace = true }
axum-test = { workspace = true }

[features]
default = []
# Basic features
ssr = ["leptos/ssr"]
hydrate = ["leptos/hydrate"]
development = []
production = ["tls", "metrics"]

# Optional feature modules
time = ["chrono", "uuid"]
tls = ["axum-server/tls-rustls", "rustls", "rustls-pemfile"]
auth = [
    "jsonwebtoken",
    "argon2",
    "tower-sessions",
    "tower-cookies",
    "sqlx",
    "chrono",
    "uuid",
    "crypto",
]
database = ["sqlx", "chrono", "uuid"]
content = ["pulldown-cmark", "ammonia", "chrono", "uuid"]
email = ["lettre", "handlebars"]
metrics = ["prometheus", "chrono"]
crypto = ["aes-gcm", "base64", "sha2", "chrono"]

# Feature combinations
full = [
    "ssr",
    "time",
    "tls",
    "auth",
    "database",
    "content",
    "email",
    "metrics",
    "crypto",
]
