# Caddy Reverse Proxy for KeluargaMart Platform
# Routes API, uploads, and frontend applications.

{$APP_DOMAIN:localhost} {
    # Authoritative Go API
    handle_path /api/* {
        reverse_proxy backend:8080
    }

    # Uploads / static assets
    handle_path /uploads/* {
        reverse_proxy backend:8080
    }

    # Central ERP SPA
    handle_path /erp/* {
        reverse_proxy erp:80
    }

    # Store POS SPA
    handle_path /pos/* {
        reverse_proxy pos:80
    }

    # B2B Storefront (default route)
    handle {
        reverse_proxy b2b:3000
    }

    log {
        output stdout
        format console
    }
}
