That hasn’t been a goal with the design of Caddy v2. We haven’t spent any time trying to make that viable/easy (may be possible in some roundabout way but we didn’t look into it).
Now, Caddy is architected around the config, so I’d recommend writing your app logic as an HTTP handler module and/or an App module; your HTTP handler can load your app with ctx.App("your_app_name") which can do anything you need, provide whatever kind of interface you want for the HTTP handler module to invoke based on your configured routes.
Using it this way gives you Caddy’s benefits of having an admin API for hot-swapping configs on the fly and gracefully reloading, etc.