Architecture of processing/p5.js
processing/p5.js is 1,299 source files holding 2,997 symbols across 7 modules, written mainly in JavaScript, TypeScript. The largest module is test, with 944 files, and 152 files are entry points into the dependency graph.
How p5.js fits together
A sketch is written as a setup function and a draw function, and drawing calls such as circle and createCanvas render the output. The src directory holds the library source, which connects startup, accessibility description generation and output formatting. Inside src/accessibility, index.js is an entry point, and describe.js covers the generation of accessibility descriptions. Rendering is split by renderer: src/core/p5.Renderer3D.js handles 3D drawing, and src/webgpu/p5.RendererWebGPU.js handles WebGPU graphics. The lib/addons/p5.sound.js file is the surface that creates sound objects and exposes their analysis methods. Unit tests live under the test directory, for example test/unit/webgl/p5.Shader.js, and package.json at the root holds the repository metadata.
Largest modules
- test: 944 files and 50,567 lines of code
- src: 152 files and 47,198 lines of code
- contributor_docs: 145 files and 17,735 lines of code
- .github: 21 files and 865 lines of code
- root: 16 files and 4,383 lines of code
- translations: 9 files and 467 lines of code
- utils: 8 files and 1,956 lines of code
- docs: 2 files and 4,901 lines of code
Languages
By file count: JavaScript 551 files, TypeScript 7 files.
Documentation
Repowise documents p5.js in 624 pages generated from the source, 23 of them written explanations of the repository and its modules. Module guides include:
- src/image: 2D Image Processing
- src/color: Color System Integration
- contributor_docs: Contributor Method Examples
More on p5.js: summary and FAQ, codebase overview, code health.
Related guide: Best dependency graph tools for monorepos