php – How to deal with spaghetti code when it comes to selling a software?

As I was a beginner in WebDev, I created a Web-App for my Orchestra for planning rehearsals (using vanilla HTML5, CSS, JS, and PHP). Over the one year of improving with new features and bug fixes, it got really powerful. Like so powerful, that a lot of people suggested selling the app to other orchestras.

There just is one problem: As a noob, I wasn’t the most efficient programmer. During making this App I learned so much, that today, I would do EVERYTHING differently. Like I would use a Framework of some kind, I would rework the UI, performance, and so on…
But now, I have that massive monster of spaghetti code of auto-generated and broken HTML with some pasted-in JavaScript and PHP. It just isn’t maintainable anymore and adding new features is a giant nightmare.

So what should I care for when starting to sell this stuff?