In my current project I use mitmproxy for that. It generates a CA that I can trust via my keychain, and don't have to worry about how to import the mkcert certificates into various servers (rails, nodejs express, next.js etc). It's easy enough to run mitmproxy parallel to the application server.