Developer guide
This part of the manual is for people who want to change Marginalia itself, write an extension for it, or just understand how it works inside. If you only want to install and use Marginalia, see the User guide.
Marginalia is a single Java web application. The browser UI is written in Java with Vaadin Flow, the services are plain Spring beans wired in XML, the data lives in one SQLite file accessed through Hibernate, and extensions are OSGi bundles that hook into the UI at runtime. The same WAR runs on a server (Docker, Jetty) and inside the desktop app.
Technology
Repository at a glance
Marginalia/
├── marginalia/ the application (Maven project, WAR packaging)
│ ├── src/main/java application code (com.github.enerccio.marginalia)
│ ├── src/main/resources Spring XML, Flyway migrations, logging
│ ├── src/main/webapp configuration.properties, persistence.xml
│ ├── src/main/frontend CSS and JS used by the Vaadin frontend
│ ├── src/desktop desktop launcher (tray icon, starts Jetty) and launch scripts
│ ├── src/test tests
│ └── plugins/ the five bundled extensions, each a separate Maven project
├── manual/ this manual (Retype sources)
├── docs/ generated manual, served by GitHub Pages
├── Dockerfile, docker-compose.yml
└── .github/workflows/ CI (desktop builds and releases)
Project structure describes the packages and files in detail.
Getting started
-
Building from source - requirements, building the WAR, running Marginalia from your IDE or a local Jetty, running the tests, building the plugins.
-
Architecture - how the pieces fit together: startup, Spring wiring, the UI, services and data, generation, extensions.
-
Then read the page about the area you want to change.
The shortest path from a fresh clone to a running instance:
git clone https://github.com/Enerccio/Marginalia.git
cd Marginalia/marginalia
mvn package -DskipTests # target/marginalia-1.0.0.war
Deploy target/marginalia-1.0.0.war (or the exploded target/marginalia-1.0.0/ folder) to Tomcat 11 or Jetty 12,
or use docker compose up --build from the repository root. Building from source has
the details.
Pages in this guide
The code is the final reference - when a page and the code disagree, the code wins, and an issue or pull request fixing the page is welcome (see Contributing).
Conventions used in this guide
-
Paths like
ui/workspace/Workspace.javaare relative tomarginalia/src/main/java/com/github/enerccio/marginalia/unless they start withmarginalia/or another top-level folder. -
Book and part are the user-facing names of
ManuscriptandChatMessage- the code still uses the old names. Likewise inference provider isAI, protocol isProtocol. -
Commands are run from the
marginalia/folder unless said otherwise.