How domumdigital/ocaf works
Project type and purpose
• This is a lightweight, static, single-page web application (“OCAF Worksheet Calculator”) whose sole purpose is to let a user quickly calculate their property’s OCAF.
• There is no traditional backend service: all logic and data live in the browser as HTML, CSS, JS, and a local JSON file with OCAF factors.
File structure
• index.html, ocaf-worksheet-faq.html, ocaf-worksheet-guide.html, etc. → the site’s entry points/view templates.
• css/ → styles for different pages (faq-styles.css, guide-styles.css, etc.) and a global styles.css.
• js/ → application logic split into app.js, config.js, faq.js, and general-purpose code in config.js.
• data/ocaf-factors.json → the static data source for calculation factors.
• wrangler.jsonc → deployment configuration (likely for Cloudflare Workers or Pages).
Extract key insights from the README
• The HTML files reference the JS and CSS assets and call out where interactivity is hooked in (e.g., a clickable image).
• The README mentions style.css and script.js generically, but your real files are more granular (styles per page, JS modules per functionality).
Main components
a. Web Browser (Client)
b. Static Asset Host / CDN / Cloudflare (Deployment target via wrangler.jsonc)
c. HTML Views (index.html, FAQ, Guide, etc.)
d. CSS Modules (global styles + page-specific styles)
e. JavaScript Modules (app.js, faq.js, config.js)
f. Data Store (local JSON file with OCAF factors)
Relationships & data flow
1) Browser requests index.html from the static host.
2) index.html includes <link> tags pulling in the CSS bundle(s).
3) index.html includes <script> tags loading JS modules in order: config.js → app.js → page-specific JS (faq.js or none).
4) app.js (or a dedicated fetch routine) issues a fetch() call to retrieve data/ocaf-factors.json.
5) JSON is parsed in JS, the calculation logic uses those factors to update the DOM (user input → computed OCAF → rendered output).
Architectural patterns & design principles
• Separation of concerns – HTML for structure, CSS for style, JS for logic, JSON for data.
• Modularity in JS – distinct files for configuration (config.js), core app logic (app.js), and page-specific code (faq.js).
• Static site deployment via a serverless platform (inferred from wrangler.jsonc).
Technologies/frameworks/libraries
• Pure HTML/CSS/vanilla JavaScript (no front-end framework).
• Cloudflare Wrangler for deployment (wrangler.jsonc).
Detail
– It’ll reveal the separation of concerns,
– Highlight runtime interactions (fetching JSON data),
– And show how assets are served/deployed,