Principles and code style (draft)ο
Defining (architectural) principles and code style keeps the code base consistent and manages expectations for contributions.
Backendο
On the backend, we use the Django framework and follow the project structure of having apps within the project.
Django apps contains models, views and API definitions. They group a logical part of the greater project which is loosely coupled to other apps.
Tests are in the django app package. Split tests in logical modules, and try to avoid complex nesting structures.
All apps must go in the
src/openzaakdirectory, which namespaces all the Open Zaak code in theopenzaakpackage. This prevents name conflicts with third party applications.Application names should always be in plural form.
Components from the API standard go in
openzaak.components.<component>.Settings go in
openzaak.conf, which is split according to deploy environment:dev
ci (Travis)
staging
production
docker
Settings must always be defined in the
openzaak.conf.includes.baseoropenzaak.conf.includes.apiwith sane defaults.Global runtime Open Zaak configuration (database backed) should go in the
openzaak.configapp.Generic tools that are used by specific apps should be a
openzaaksub-package, or possibly go inopenzaak.utils.Integration with other, third-party services/interfaces should go in a
openzaak.contribpackage. This is currently (!) not the case yet.Code style and imports are enforced in CI with ruff.
Frontendο
Javascript goes in the
src/openzaak/jsdirectoryIf possible, stick to Vanilla JS
(Highly) dynamic interfaces are built using React. Components should:
go in
src/openzaak/js/componentspreferably use functional components with react hooks
aim to be prop-driven and keep as little local state as possible
be properly prop-type annotated
have default values for optional props
Code should be linted and quality checked using ESLint, with the AirBnB preset
Browser support: latest and latest -1 version of the major browsers