modSociety — social and comment layer for MODX

modSociety emerged from a very practical need: MODX was great as a project foundation, but for websites with live user-generated content, it lacked several basic entities. Blogs, topics, comments, ratings, relationships between them, access control — all of this either had to be assembled from scratch every time or extracted into a separate reusable layer.

That is how modSociety came to be. It was conceived not as a ready-made forum or a social network with a rigid interface, but rather as an additional tier over MODX that provides the project with social entities while leaving freedom in how exactly to use them.

Traces of early development date back at least to the beginning of 2013. A GitHub Gist with modBlog loading already shows modSociety, the core/components/modsociety/ directory, and the derived modBlog class. This clearly illustrates the initial idea: modSociety was meant to be the base layer, with specific application logic built on top of it.

A year later, this approach was already being used in a real large-scale project. In the publication “MODX-Club: updated version of the website”, I described the migration of the Club from the old platform to the new architecture, where modSociety became the basis of the blog and social section of the site. Blogs, topics, comments, users, and ratings were migrated to it.

At the same time, not only the set of entities itself was important. One of the main tasks was to ensure that the social layer coexisted properly within the MODX security model. Blogs and topics could have different access levels, and queries had to take policies into account and return to the user only what they were actually allowed to see.

That is why modSociety has always been for me more of an extension of the MODX approach itself than a separate end product. The logic was built around processors, models, and xPDO, while the presentation layer remained separate. The interface could be built using Smarty via modxSmarty or in a completely different way — the social entities remained unchanged.

Later, modSociety continued to be used not only within MODX-Club. For example, in NewsModxBox, it was used as a commenting layer, along with phpTemplates/modxSmarty at the presentation level and processors at the application logic level. This is precisely the scenario the component was created for: not a complete website, but a reusable piece of architecture.

Today, the project's source code is available in the MODX-Club/modSociety repository on GitHub. The component itself already belongs to the legacy era of MODX development, but architecturally it clearly shows the direction I arrived at back then: making maximum use of standard MODX mechanisms, adding missing entities as a separate layer, and avoiding mixing business logic with a specific frontend representation.

In this sense, modSociety nicely complements my other components from the Fi1osof ecosystem: modxSite was responsible for the logical and API layer of the project, modxSmarty for the presentation, and modSociety provided the basic entities for projects where users create content and interact with each other.