Skip to content

Movim Core Architecture

Jaussoin Timothée edited this page Nov 25, 2015 · 2 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 and SessionX 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…)
  • models containing the models used in Movim through the Modl library
  • views gathering the views of the project, most of the time linked to a controller
  • widgets containing all the Widgets of the project

lib

This directory contains all the libraries of the project.

  • 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

vendor

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

locales

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

system

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

  • Cache which is used for storing data that need to be kept between user sessions into database
  • Session is quite similar to Cache but only stores data for one session (in the memory)
  • Event is the link between the Modl library and the Widgets
  • Picture generates the URL of the images, creates the corresponding thumbnails and keeps them stocked
  • 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
  • SessionX is similar to Session but deals with the XMPP session (which is crucial for Movim to work properly)
  • User stores the current status of the user
  • Utils contains lots of useful functions you will be able to call wherever you want in Movim and that can complete some classical PHP functions

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.

  • config contains the current configuration of the server
  • users contains the documents of the users who created their account on the server
  • cache contains the avatars, thumbnails and temp files generated by Movim
  • log obviously contains the logs of the project