[workspace]
members = [".", "avam-wasm"]
resolver = "2"

[package]
name = "avam"
version = "0.1.0"
edition = "2021"

[lib]
name = "avam"
path = "src/lib/lib.rs"

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

# Defines a size-optimized profile for the WASM bundle in release mode
[profile.wasm-release]
strip = "debuginfo"
inherits = "release"
opt-level = 'z'
lto = true
codegen-units = 1
panic = "abort"

[features]
hydrate = ["leptos/hydrate", "leptos_meta/hydrate", "leptos_router/hydrate"]

ssr = [
    "dep:argon2",
    "dep:dotenvy",
    "dep:rand",
    "dep:tokio",
    "dep:tracing-subscriber",
    "dep:leptos_axum",
    "dep:lettre",
    "dep:tera",
    "dep:sqlx",
    "dep:axum",
    "dep:axum-macros",
    "dep:axum_session",
    "dep:axum_session_sqlx",
    "dep:tower",
    "dep:tower-http",
    "dep:tower-layer",

    "leptos/ssr",
    "leptos_meta/ssr",
    "leptos_router/ssr",
]

[dependencies]
# Utilities
anyhow = { version = "1.0.89", optional = false }
argon2 = { version = "0.5.3", optional = true }
derive_more = { version = "1.0.0", features = ["full"], optional = false }
dotenvy = { version = "0.15.7", optional = true }
rand = { version = "0.8.5", optional = true }
serde = { version = "1.0.210", features = ["std", "derive"], optional = false }
thiserror = { version = "1.0.64", optional = false }
tokio = { version = "1.40.0", features = ["full"], optional = true }
tracing = { version = "0.1.40", optional = false }
tracing-subscriber = { version = "0.3.18", features = [
    "env-filter",
], optional = true }
uuid = { version = "1.10.0", features = [
    "v4",
    "fast-rng",
    "serde",
], optional = false }

# Leptos
leptos = { version = "0.6", features = ["nightly"], optional = false }
leptos_axum = { version = "0.6", optional = true }
leptos_meta = { version = "0.6", features = ["nightly"], optional = false }
leptos_router = { version = "0.6", features = ["nightly"], optional = false }

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

# Database
sqlx = { version = "0.8.2", default-features = false, features = [
    "uuid",
    "runtime-tokio-rustls",
    "macros",
    "postgres",
], optional = true }

# Web
axum = { version = "0.7.7", optional = true }
axum-macros = { version = "0.4.2", optional = true }
axum_session = { version = "0.14.0", optional = true }
axum_session_sqlx = { version = "0.3.0", optional = true }
tower = { version = "0.4", optional = true, features = ["util"] }
tower-http = { version = "0.6.1", features = ["trace", "fs"], optional = true }
tower-layer = { version = "0.3.3", optional = true }
http = "1"
validator = "0.18.1"

[[workspace.metadata.leptos]]
name = "avam"
site-root = "target/site"
site-pkg-dir = "pkg"
style-file = "style/main.scss"
assets-dir = "public"
site-addr = "0.0.0.0:3000"
reload-port = 3001
browserquery = "defaults"
watch = false
env = "DEV"

bin-package = "avam"
bin-default-features = false
bin-features = ["ssr"]

lib-package = "avam-wasm"
lib-default-features = false
lib-features = []
