Recommended servers/methods for adding dynamicity to Hugo site?

Hey folks, I realize this isn’t Hugo-specific, but maybe someone has a helpful suggestion.

I have a Hugo site on Netlify that more or less serves me well. However, I’d like to add some Netlify-specific functionality that uses functions/authentication, and tying myself to Netlify in that way makes me nervous. Is there a web server I can easily host in something like a Docker container, and push a Hugo site plus something like CGI scripts to so I can add dynamic functionality alongside the rest of the assets?

Essentially, I’d like to do some sort of passwordless login flow, and Stripe web hooks for Patreon-style memberships. Caddy seems promising, but I can’t find a plugin that does what I’d like.

Netlify lets you write JavaScript functions storied at /.netlify/some_function, which can then be called normally. It’d be nice if I could somehow store scripts/ modules, etc. in /static, integrate their build process into that for my site, and host that myself. I’m not wedded to JavaScript at all–that’s just what Netlify uses so I’m mentioning it as an example.

Thanks for any pointers!

I build and host Hugo sites on my own server instance. Project files are with GitHub and I use a webhook and hosted deploy.php script to pull requests and rebuild to a publishDir set in config.toml. See: Automating the deployment of your static site with Hugo and GitHub | Go Make Things

Your site requirements are more complex than mine but perhaps the additional flexibility that comes with independent hosting is what you’re looking for.