Overview

This section is intended to give a brief overview about the general structure of Kadi4Mat’s source code. Specifically, the focus lies on everything contained inside the kadi directory.

assets

This directory contains all kinds of assets used in the application. Most assets are used in the frontend, namely the JavaScript code, not including smaller scripts written directly in some of the HTML templates, stylesheets and frontend translations, found in the scripts, styles and translations directories respectively.

Most code inside the scripts directory is written in plain JavaScript that is either used globally or only on certain pages. All files using the .vue file extension contain Vue.js components instead, which are used to encapsulate reusable frontend code. See also writing frontend code. The styles directory contains all stylesheets used by the application, usually .scss files using the Sass extension. For more details about the translations, see Translations.

cli

This directory is a Python package that contains code relevant for the Kadi command line interface (CLI). The main command of the CLI is specified by using the console_scripts entry point defined in setup.py as provided by setuptools. For building the actual interface, the Click library is used.

ext

This directory is a Python package that contains code relevant for all extensions used in the application. Most of them are Flask extensions, which are specifically made to be used inside an existing Flask application. They are often just wrappers over other libraries, making the integration into a web application context easier. For most extensions, a global extension instance is created that can be used throughout the application. Generally, this is made possible by storing all configuration values needed for an extension to do its work in the current application object.

lib

This directory is a Python package that contains code providing general or common functionality as well as miscellaneous helper functions. See Lib for a complete API reference.

migrations

This directory contains all scripts and configuration files relevant for running database schema migrations, which correspond to adjustments in the model classes defined using SQLAlchemy. The versions directory contains the actual, incremental migration scripts, ordered by their date of creation. Each script has an upgrade and downgrade function, to apply or revert changes to a database schema, and potentially data, respectively. See also how to adjust or add database models.

modules

This directory is a Python package that contains most of the main functionality regarding the management of different resources, users, settings, etc. via the GUI and the API. Each module (not to be confused with Python modules) is grouped into a separate subdirectory, which structures all the related code and templates. The latter generally make use of Jinja for server-side rendering. See Modules for a complete API reference.

plugins

This directory is a Python package that contains code used for writing plugins, as well as all first party plugins and internal implementations using the plugin functionality. See Plugins for a complete API reference.

static

This directory contains static files that can be served, more or less, directly via a web server, e.g. processed scripts and stylesheets or images. Regarding the former, see also writing frontend code.

templates

This directory contains common and globally used HTML templates, snippets and macros.

translations

This directory contains different files needed for the backend translations. For more details about the translations, see Translations.

vendor

This directory is a Python package that contains (adapted) third-party code.