I am working on a social app in RN and had a lot of problems with different ddp clients (ddp-client was the first I’ve tried), especially using Meteor 1.3 with Mantra. After some time (tried 4 libraries) I came to (mentioned by @jitterbop and @spencercarli already)
It uses the same syntax as in Meteor, so you can use the usual
etc. They have an awesome support on GitHub and StackOverflow and helped me within minutes after I have posted and are extreme friendly on top (wish I could say that about the support of many big companies…). Things that work out of the box that might have problems in other frameworks:
- Signup, login
- Reactive data source (e.g. automatically recognise if user was logged out, etc.)
On top they have some cool stuff like a special list view where you only pass the collection name and it fills itself. The repository seems to be updated very frequently as well. It also made the code to write much shorter and self explanatory. Using ddp-client and similar required quiet an amount of time, just to make simple things work, while with react-native-meteor everything was done within short time (and less pain).
To answer your question:
Using ddp-client: it might be most easy to create a singleton that handles the connection to the database and one class for each collection.
The db.js for example handles connect, disconnect, automatic reconnect and offers some promises to check if the user is connected (so you GUI can react accordingly).
The collection classes handle everything which is related to a particular class. For example it you have a todo list, the todos.js could handle
create todo item
find all todo items
set todo item as completed
The db.js is included everywhere you need it, so you only establish one DDP connection (to keep the server load down and also the network traffic).
The collection classes also import the singleton.
You can find a tutorial for this kind of implementation here.