That's totally fine having to run the compiler, I've done it with some projects (using nimscript at runtime). I figured that's how it probably has to happen!
What I've been doing so far is using the commandline to execute nim code, targeting the JS backend. This produces a file though. Rather than writing to and reading from that file I'd like to have a string returned from a procedure. Or at least have the result via stdout so I can read it from there I guess lol