DEV Community

Jan Dvorak
Jan Dvorak

Posted on • Updated on

Socialize

Socialize is a namespace in Meteor packages that is an umbrella for packages which allow you to add functionality you know primarily from social media to your Meteor app. These packages are front-end agnostic and provide you default publications to get started quickly.

Full disclosure, I help develop these packages and heavily use them, in fact they are the core of my projects. I also financially support Kelly Copley, the creator of these packages.

When would you need these?

In short these will be useful to you when ever you want to add social features to your app, from basic comments to interaction between users. These packages give you the foundations to add the functionality quickly so you can focus on the main value of your app.

Redis Oplog

Scalability is a consideration, hence the most used packages also include automatic integration with Redis Oplog. Thanks to Meteor it is a simple plug and play. So once you reach that threshold, you can quickly improve performance.

React-native

With social there might be a need for you to have a more tightly integrated mobile app. If your chosen technology is react-native, then Socialize has you covered! You will find companion code published to npm so that your Meteor and react-native apps are compatible.

The building blocks

base-model

This is the building block of the entire system. Normally you will use simple-schema to create a schema for the model (in this case I'm talking about the object of the document you retrieve when you fetch the documents from DB) to ensure data consistency in your MongoDB. This will make your models extensible and the class you write for your collection will allow you to define functions to run against your documents. For example getting profile.fullName() which is going to combine the givenName and familyName into one string to name a simple use case. This function is then attached to all retrieved documents for your convenience. In more advanced cases Socialize uses this to perform operations on the data.

server-presence

This package keeps track of servers running your application and provides a way to run cleanup tasks when they die. The good thing about this package is it can be used independently, but you will most likely use it as a dependency of our next package.

user-presence

Simple and scalable package for keeping track of users online, offline and idle statuses. The beauty of this package is that it allows you to set the place where you want to store the values (and has a few extra goodies).

server-time

A super light weight package to compensate for the difference in time on the server and client. Independent of the rest of the Socialize packages, but many depend on it.

user-model

This package extends Meteor's user model to make it easily extensible by you and other Socialize packages. This will be most notably achieved by linkable-model package.

linkable-model

In short it allows you to link data from one collection to another. OK, that was too simplistic. This is a linkage in the model that allows you to establish a link and then retrieve data from that link. For example you link your blog posts to comments and then you can retrieve the comments via a call on the blog document: post.getComments().

requestable

A very useful package that allows the creation of requests. In the Socialize system it is used for friend requests, but you can use it for other things, like group membership requests, as well.

The functionality

likeable

It is all about the likes. This will add capability to your app to link a collection (see linkable-model above) to likeable which then allows you to add liking, starring, favoriting (or what ever you want to call it) to anything you want.

voteable

If you want to have the down vote option instead of just liking this package is your choice (you can have both, they are not mutually exclusive).

user-profile

It is not recommended to put any user data on the default user documents in Meteor, so Socialize comes with profile documents that are linked to the users so that you can build the users profiles as you need them. This gives you a user profile that you have a full control over without any risks.

friendships

Socializing is all about establishing the connections between people. Friending is one of the core features. This will give the users the ability to request friendship or block annoying users (thanks to the user-blocking package).

user-blocking

Tightly coupled with the friendship package this allows you to create a functionality for your users to block other users. This blocking is then used in other packages like feed to not show content from blocked users.

messaging

Everything you need to create an internal messaging system in your app. Be it 1 on 1 conversations or large chat rooms, this package has you covered from the basics of sending messages and to details like typing, read, observing and in-flight statuses.

Thanks to Meteor's reactivity this is the perfect application of its strongest suits.

postable

A package to create posts on any other document. This is the base of the feed package, but since these two are separate it allows you to create posts on say groups. You don't want to use this for something like blog posts (for blogs you might want to have additional things like tags, categories, etc.), so think about this like Twitter styled posts.

feed

A feed for users like you know them from Twitter, Facebook and other social media. Compared to the basic postable package, it has integrated the user blocking package so it won't show posts from users that are blocked.

My personal recommendation is to add commentable and likeable to the your feed for the full experience.

commentable

Allows you to add comments to any other models. The benefit here is that rather than having separate comments on each collection you want to have a dedicated collection from which to pull them for each commentable document. This allows you to create a general component to retrieve comments as well which will result in unified UX when it comes to comment and make it easier to maintain.

Again, my personal recommendation is to combine this with likeable if you want Facebook/Twitter like experience or with voteable if you want Reddit like experience.

voteable

The most recent addition to the set allows you to up vote or down vote on the connected collection.

Since it is the most recent it doesn't have a companion npm package like the rest, so you won't be able to use it with react-native at the moment.

Technical side note

Due to tight integration of all the packages, it has become a nightmare to manage all the versions for release. As such Kelly has created a cli tool to make sure that all version are fixed.

You will also find a package for Cloudinary under the socialize namespace.

Future

The packages are in active development and use. There is also work and plans for new features like notifications and groups.

I'm working on a socialize-starter for Meteor that will showcase most of the packages in an starter app where all the basics will be taken care of, allowing you to jump straight into developing your app. Stay tuned for another post about that (hopefully soon).

Finally I'm considering adding GraphQL schemas, so that you can easily integrate it into your GraphQL API as well.

So please consider giving them a try and letting me and Kelly know what you think and if you encountered any issues.

Finally if you like the packages and/or would like to see more development on them, please consider sponsoring Kelly on GitHub.


If you like my work, please consider supporting me on GitHub Sponsors ❤️.

Oldest comments (0)