The only reason why the Star Trek "economy" works without any sort of money is because they've eliminated scarcity. They can use replicator technology to create whatever they need.
But even then, not all things can be replicated: Things of subjective value like writing, art, film, even new inventions will still require work by human hands and will be valued differently by different people. There will always be markets for something even if basic necessities are no longer scarce.
P.S. The Star Trek economy is all mixed up and seems to change from episode to episode.