Using external Classes?

Permalink
We have a private, internal web app for company use, and on the same server, a public company website. The internal web app keeps track of inventory, among other things. Currently, the public site has an iframe pulling inventory from the private site.

The private site has its own classes, objects, and database to keep track of everything.

I want to update our public website to Concrete5 and add functionality to seamlessly interact with the private inventory.

I am not opposed to rewriting the private webapp into Concrete5 as a private Package, if it would make this any easier. I am most opposed to maintaining two different code bases.

Without maintaining two similar code bases, what would be the best way to use the existing classes or minimize re-coding? Or links to already existing answers for which I'm not correctly searching.