Basically, you set up a "custom app host" -- stand up your server (which has your code components), and you add a route (say `https://yoursite.com/plasmic-host`) that renders a special `<PlasmicCanvasHost/>` component. When you open a Plasmic project that uses your custom app host, it loads your `/plasmic-host`, and the `<PlasmicCanvasHost/>` component bootstraps the Plasmic visual editor into the page. So now Plasmic studio is actually running on your page, and it can access your code components that you have registered to be used with Plasmic. We never see your code; it's a run-time integration.
No, if you use codegen, you should register your component by providing additional necessary metadata, like importPath, importName and others. Then you can use you component in the Studio same way like other builtin components. Check https://docs.plasmic.app/learn/code-components-ref/ for more details.