I wrote something similar at my last job. Mostly because the frontend devs wanted good documentation, and the docs kept falling out of sync with the codebase. So I integrated it with a test framework: https://github.com/savantgroup/literate_integration