The core logic of Penpot is organized into several key modules located under common/src/app/common/:
geom
Manages 2D geometric entities:
point: Defines the 2D Point type and geometric transformations.matrix: Defines 2D transformation matrix types and operations.shapes: Manages shapes as collections of points with bounding rectangles.
path
Manages SVG paths, including transformations and converting other shape types into paths.
pages
Contains the Penpot data model and conceptual business logic (transformations independent of UI or storage):
spec: Defines data structures for files and shapes using Clojure spec; includes the changes module transformations.init: Defines default content for files, pages, and shapes.helpers: Utility functions for manipulating data structures.migrations: Manages data model evolution. It identifies file versions and applies necessary migrations to the data content.changes & changes_builder: Defines transactional operations (e.g., adding a page/shape, changing attributes) that perform semantic operations on file data.
types
An evolving module aimed at implementing the Abstract Data Types paradigm for the Penpot model.