How bartoszluka/bdsm-compatibility works
Project type and purpose
• This is a single-page application (SPA) written in Elm, served as a static site via Netlify.
• Its purpose is to accept two pasted BDSM-test result strings, parse them, compute a compatibility score, and render the result in the browser.
Main components
a. User’s Browser / Client
• Loads index.html
• Runs the Elm runtime
b. Elm Application (Model-View-Update architecture)
• Main.elm – initializes the app, defines Model, Msg, View, Update
• BdsmTestResults.elm – encapsulates the core compatibility-scoring logic
• ParserExtra.elm – helper functions for parsing raw test data
c. Static Assets & Configuration
• index.html – host page bootstrapping Elm
• elm.json – Elm dependencies & configuration
• netlify.toml – Netlify build/deploy settings
• optimize.sh / live.ps1 – optional build‐optimization or local‐serve scripts
d. Test Suite
• tests/ScoringTests.elm – Elm unit tests for the compatibility logic
e. Deployment Pipeline (Netlify / CI)
• Netlify build step (elm make, optimize.sh)
• Continuous deploy on git push
Relationships & Data Flow
• Within Elm:
• View dispatches Msgs (e.g. Paste1Changed, Paste2Changed, CalculateCompatibility)
• Update handles Msgs → updates Model or calls BdsmTestResults.parseAndScore
• BdsmTestResults uses ParserExtra to process raw input → returns compatibility score
• Update stores score in Model → View re-renders result
• No external API calls – purely client-side computation
• Tests invoke BdsmTestResults.parseAndScore directly, verifying correctness
Architectural patterns & design principles
• Elm’s TEA (The Elm Architecture – unidirectional data flow, immutable Model)
• Modular separation: parsing logic (ParserExtra), scoring logic (BdsmTestResults), UI orchestration (Main)
• Static hosting / CI-driven deploy (Netlify)