name = "mod-storefront"
compatibility_date = "2026-08-19"
compatibility_flags = ["nodejs_compat"]
main = "@astrojs/cloudflare/entrypoints/server"

[assets]
directory = "./dist"
binding = "ASSETS"

# D1 binding — FUTURE WORK: commerce-* modules emit Postgres-only DDL; D1 SQLite DDL is a separate
# per-module task. Until SQLite DDL is ready, set DATABASE_URL secret (Neon/Postgres) instead.
# Uncomment when all commerce module DDL is SQLite-compatible.
# [[d1_databases]]
# binding = "DB"
# database_name = "mod-storefront-db"
# database_id = ""
#
# Required vars (set via `wrangler secret put` or [vars] in wrangler.toml):
#   SITE_ORIGIN  — public base URL, e.g. https://shop.example.com (required for password-reset emails)
#   DATABASE_URL — Neon/Postgres connection string (required until D1 DDL is complete)
#   AUTH_SECRET  — at least 16 random chars (required; `openssl rand -base64 32`)
#   STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, STRIPE_WEBHOOK_SECRET — set after install

[[kv_namespaces]]
binding = "SESSION"

[[r2_buckets]]
binding = "MEDIA"
bucket_name = "mod-storefront-media"

[[ratelimits]]
name = "STOREFRONT_LOGIN_LIMITER"
namespace_id = "2001"
  [ratelimits.simple]
  limit = 10
  period = 60

[[ratelimits]]
name = "CHECKOUT_LIMITER"
namespace_id = "2002"
  [ratelimits.simple]
  limit = 30
  period = 60

[[ratelimits]]
name = "ADMIN_LOGIN_LIMITER"
namespace_id = "2003"
  [ratelimits.simple]
  limit = 10
  period = 60

[[ratelimits]]
name = "ADMIN_API_LIMITER"
namespace_id = "2004"
  [ratelimits.simple]
  limit = 120
  period = 60

[[ratelimits]]
name = "INSTALL_LIMITER"
namespace_id = "2005"
  [ratelimits.simple]
  limit = 5
  period = 60
