Develop a plugin. Follow the plugin structure described here.
Write code for each plugin type using the corresponding variables, methods and items. Put the scripts into the src folder. Specify the required Plugin interface for each plugin to be embedded in the portal.
Learn which plugin components can be used for the DocSpace plugin interface and add them to your scripts.
Code samples are available at https://github.com/ONLYOFFICE/docspace-plugins.