How softwareverde/pos-cash works
Project type and purpose
• This is a purely client-side, single-page web application (“Bitcoin Cash Point of Sale”) for accepting BCH payments without any custom backend.
• It runs entirely in the browser, fetching static assets (HTML, JS, CSS, images, audio) from a static file host and talking only to external payment-alert services.
File structure
• Top-level:
• scripts/ — build helper (make-libauth.sh)
• www/ — all runtime assets
• Under www/:
• index.html — SPA entry point
• css/, js/, img/, dat/ — static assets
• js/widget/ & css/widget/ — modular UI screens (checkout, payment, settings, etc.)
• api/v1/*.json — static reference data (countries, currency symbols, strings)
• No backend directory or server code.
README for additional insights
• No server code required—only simple HTTP(S) hosting.
• Uses localStorage for user configurations.
• Integrates with bitcoin.com, blockchain.info, bitcoinverde.org for “payment alerts.”
Main components and interactions
a. Static File Server (any HTTP(S) host)
• Serves index.html and all assets on request.
b. Browser Client
• Loads index.html → initializes core.js, init.js.
• Dynamically loads widget modules (checkout-screen.js, payment-screen.js, etc.) and corresponding CSS.
• Reads/writes user settings to localStorage.
• Renders UI and handles user input (QR-scanner, on-screen keyboard).
c. LocalStorage
• Persists merchant configuration (payment currency, UI preferences).
d. External Payment-Alert Services
• Polls or subscribes to bitcoin.com, blockchain.info, bitcoinverde.org endpoints.
• Receives callbacks/notifications when BCH payments arrive.
e. Static Reference Data
• Loaded from www/api/v1 JSON files (country list, currency symbols, UI strings).
Architectural patterns and design principles
• Modular widget architecture: each screen is a self-contained JS/CSS module.
• “Static Single-Page App” pattern: no server logic, assets + code run in browser.
• Separation of concerns:
• UI layers (HTML/CSS)
• Logic layers (core.js, widget scripts)
• Data storage (localStorage)
• External integrations (HTTP API modules).