Platform & Performance
MPTS runs entirely in the browser. This document covers the technical platform, browser requirements, and performance characteristics.
Browser Requirements
- JavaScript โ required; the application is a single-page app with no server-rendered fallback for the editor
- WebSocket โ required for real-time communication with the server (Socket.IO)
- SVG โ the entire canvas is drawn using SVG elements; SVG 2.0 features are preferred, with SVG 1.1 compatibility workarounds for Safari
- HTML5 โ modern layout features (`dvh` units with fallback, `contentEditable`, Clipboard API)
The application works in all modern evergreen browsers: Chrome, Firefox, Safari, Edge.
Mobile & Tablet Support
The application is designed to work on touch devices:
- Viewport โ set to device width with zooming disabled (`user-scalable=no`) to prevent browser zoom from interfering with canvas zoom
- Touch gestures โ single-finger pan, two-finger pinch-to-zoom
- Touch action โ CSS `touch-action: manipulation` on the SVG and `touch-action: none` on the canvas group give full gesture control to JavaScript
- Orientation โ both portrait and landscape are supported
- PWA installable โ the application can be installed on mobile home screens for a native-like experience
Progressive Web App
The application includes a full PWA manifest with:
- Display mode โ standalone with window-controls-overlay support
- Icons โ a complete set from 16px to 512px, plus maskable and SVG variants
- Orientation โ any
- Theme colour โ matches the application design
However, there is no service worker โ the application requires a network connection. PWA installation provides a native-like shell but not offline capability.
Build System
The frontend is built with Webpack using esbuild-loader for fast TypeScript compilation:
- Target โ ES2017 for the browser bundle
- Caching โ filesystem cache for fast incremental rebuilds
- Source maps โ enabled for development
- CSS โ processed via `style-loader` and `css-loader`
- JSON modules โ all i18n JSON files are bundled at compile time
The backend TypeScript targets ES6 and runs directly via `ts-node`.
SVG Canvas Architecture
The editor's canvas is a single SVG element. All process elements, flow diagrams, connections, and annotations are SVG groups, paths, and text elements:
- Direct DOM manipulation โ no virtual DOM library; elements are created and updated by setting SVG attributes directly
- GPU acceleration โ the canvas group uses `will-change: transform` during active pan/zoom operations, promoting the layer for hardware-accelerated compositing and demoting it when idle
- ViewBox rendering โ zoom and pan are implemented by updating the SVG `viewBox` attribute, which is more efficient than transforming individual elements
- User selection disabled โ `-webkit-user-select: none` and vendor-prefixed equivalents prevent accidental text selection during drag operations
Caching and Loading
Static Assets
Fonts, images, icons, and SVG assets are served with a 30-day immutable cache header. This means they are fetched once and served from the browser cache on subsequent visits.
Speculative Loading
On Chromium 121+, the application uses the Speculation Rules API to prefetch and prerender related pages. Other browsers gracefully ignore this.
Font Loading
The application uses JetBrains Mono (weights 400 and 700) loaded from Google Fonts with `font-display: swap` โ text renders immediately with a system font and swaps to the web font once loaded.
Third-Party Services
- Socket.IO โ real-time bidirectional communication for save/load and ID generation
- Cloudflare Turnstile โ CAPTCHA verification for authentication
- Google Analytics โ usage tracking
- Stripe โ payment processing for premium features
Performance Tips
- Use programmatic mode for bulk operations โ when loading files or performing batch changes, the system suppresses reactive DOM updates until the batch is complete
- Suppress notifications during batch commands โ prevents the history panel from re-rendering after every single change
- Grid label limits โ the grid system caps labels at 48 per axis to prevent rendering overhead at high zoom levels
- ViewBox caching โ the viewBox string is only updated when it actually changes, avoiding unnecessary reflows
- Pointer event throttling โ mouse/touch move events are throttled to the display's frame rate via `requestAnimationFrame`
- SVG pattern tiling โ the grid background uses SVG patterns which the browser tiles efficiently, rather than drawing individual lines