Reverse engineering the Zotero Client – Internal structure

All the logic for the Zotero client (both Windows and Mac) is in the repository https://github.com/zotero/zotero. If you want to build Zotero on your machine from source code, you should also download the build and standalone build as described in the Zotero documentation for contributors.

The Zotero client uses:

  • JavaScript compiled with npm for the actions
  • Mozilla XML User Interface Language (XUL) for the user interface

The user interface, languages and styles are in the zotero/chrome folder. The zotero/chrome/content contains the user interface and code for actions:

  • zotero/chrome/content/zotero contains the standard user interface with the menus, the panes and the components
  • zotero/chrome/content/zotero-platform contains the system specific tweaks for the Windows, Unix and Mac versions

By far, the most interesting code related to the user interface is in the zotero/chrome/content/zotero folder. The outer scaffold of the interface is created by the file zoteroPane.xul. Most of the menu items are created in the standalone/standalone.xul file. There is a preferences subfolder for the preferences dialog box.

The zotero/chrome/locale folder contains the dtd translations.

In the folder zotero/resource/schema are the SQL definitions of the tables used by Zotero. Zotero stores data locally on a sqlite database located in the Zotero Data Directory, which on Windows systems is usually the %homepath%/Zotero directory.

Translators

Translators allow Zotero to import items from webpages or databases, and export them according to the specified style. Translators are basically JavaScript code that follow a well defined structure, or interface.

The translators are in a separate zotero/translators GitHub repository for easier maintenance. Locally, the translators are stored in the Zotero Data Directory under the translators subdir.

The Zotero client provides an IDE to create, modify and debug custom translators. The source code of the IDE is under the zotero/chrome/content/scaffold directory. Such IDE can be accessed via the Tools -> Developer -> Translator Editor menu.

See also