As long as your app is capable of server-side rendering (SSR) then you can render it in a Sitecore Content Management (CM) role and use Experience Editor (EE) to manage the app and content for the app.
Beyond that, your app can live on a Node.js server somewhere (separate from Sitecore) and consume Layout Service data for rendering.
You are not able to use Experience Editor in a headless fashion. In other words, Experience Editor requires a Sitecore instance as it is very much a Sitecore-bound application.
That said, it's also important to understand that your application can run in different modes depending on the environment it is in.
For example, your app can run in Integrated Mode
in a Sitecore Content Management (CM) environment in order to enable EE management and preview. Then, in your delivery environment (i.e. "production"), your app can be hosted or run headlessly using either Headless SSR
mode or API Only
mode - with your app fetching Layout Service data from a Sitecore Content Delivery (CD) environment.
That is just one example to help illustrate that there are different possible configurations in order to suit your implementation needs.
The Application Modes section of the JSS docs might provide further insights: https://jss.sitecore.com/docs/fundamentals/application-modes