How to structure app with modular packages and managing data/state?


I’m pretty new to Meteor and development in general. And I’ve learned a lot in the past two months from the Meteor community. So thank you all.

Now lately, I’ve been trying to build more complex projects, but find it extremely difficult to structure my app in a modular way. I’ve been reading a lot about using packages to structure Meteor projects, and love the idea.

But I don’t quite understand how to manage the flow of data in and out of packages. For example, I want to create a newsfeed component that displays posts and contains a form to insert new posts. I want it to be a standalone component that can be embedded into any application. What is the best approach for passing data to the component/setting the data context, and inserting the data back into a collection in the application? I can’t just make a call to an insert method because I wouldn’t know what methods are available in the application… Appreciate all the help!