Skip to content

Movim Core Architecture

Jaussoin Timothée edited this page Jul 3, 2023 · 4 revisions

The architecture of Movim can be divided into several parts communicating with each another. Before understanding the part they play in the project and how they work it can be interesting to know the environment in which the whole project works.

Environment of Movim

Movim is a Web client, developed largely in PHP which can be deployed on a web server (Apache, nginx ... ) . This server provides a social network Web interface XMPP which will be the intermediary between the browser and the XMPP server that contains the user account.

It also communicates with an SQL type database to store some of the information it manages.

Movim therefore provides a set of tools and APIs for communicating information to:

All these components are orchestrated by a minimalist heart in charge of:

  • Loading the pages (via a slightly adapted Model-View-Controller system)
  • Sending events corresponding to the reception of XMPP packets (via the Event class)
  • Maintaining the session open during the users' connection (via the Session classes).
  • Rewriting URL and generating Roads (via the Route class)
  • Managing internationalization (via the i18n class)
  • Managing Configuration
  • Loading Widgets and their interconnection to the rest of the system

Structure of the code

The source of Movim is organized in a Ruby on Rails like structure.

app

This directory contains the entire Movim "application" built over the heart and the libraries. It is the most commonly modified during development. It contains several subdirectories :

  • assets which contains all the "definitive" files which will be directly sent to the browser (e.g the Javascript files)
  • controllers listing all the controllers of Movim
  • helpers containing basic functions for the developer (date, string, timezone management…)
  • views gathering the views of the project, most of the time linked to a controller
  • widgets containing all the Widgets of the project
  • And the models of the projects

vendor

This directory contains all the external libraries loaded using the PHP dependency manager Composer.

  • Moxl - Movim XMPP Library
  • The Markdown library which lets you layout your posts in Movim and convert them into XHTML
  • The RainTPL library which is the bound between views and Widgets
  • The Ratchet library to handle and manage the Movim daemon and the WebSockets
  • and others…

locales

You will find all the internationalization files in this directory. We use Gettext to translate Movim.

src

The heart of the architecture of Movim is contained in this directory. You will find several classes including :

  • Session is quite similar to Cache but only stores data for one session (in the memory)
  • Event is the link between the Moxl library and the Widgets
  • Picture generates the URL of the images, creates the corresponding thumbnails and keeps them stored
  • Route generates the links with the controllers and views and makes URL rewriting possible
  • RPC works with Event to let the Widgets communicate directly with the browser

And some other librairies such as:

  • XMPPtoForm which lets you convert XMPP forms (see the XEP-0004: Data Forms into HTML forms and the other way round.
  • SDPtoJingle and JingletoSDP which convert SDP packets into Jingle (voir XEP-0166: Jingle) packets and vice versa for the videoconferencing feature via WebRTC

themes

This directory contains the styles of the interface of Movim :

  • CSS files
  • Images and icons
  • Fonts

Other directories

Other directories present in Movim are generated during the installation.

  • cache contains the avatars, thumbnails and temp files generated by Movim
  • log obviously contains the logs of the project