How alexbs01/brightbills works
Project type and purpose
• BrightBills is an open-source, static web application for optimizing residential electricity bills.
• It is implemented entirely in native HTML, CSS and JavaScript with no back-end or external dependencies.
• The user opens index.html in a browser, enters form data and gets two calculations: “Fijo” power estimation and “Tarifa” comparison across three distributors.
File structure
• Top level:
• .gitignore, code of conduct, licenses, readme
• src/
• src/ folder:
• index.html → single HTML entry point
• script.js → core business logic (form handling, calculation functions)
• styles.css → visual styling
• No build or deployment scripts—straightforward static hosting.
Key architectural observations
• It’s a single-page application (SPA) pattern but without a framework.
• Separation of concerns:
• Presentation layer: index.html + styles.css
• Logic layer: script.js
• No data persistence, no API calls, all data and tariff rates are hard-coded or entered by user.
a. Browser (client)
b. Presentation layer
– index.html (DOM structure)
– styles.css (UI styling)
c. Logic layer
– script.js
· Form input handler
· Fijo calculation module
· Tarifa comparison module
· DOM update/output module
d. Data elements
– User input (form fields)
– Internal tariff rate data
– Computation output
Relationships and interactions
• Browser loads index.html → includes script.js and styles.css
• User interacts with UI form → events fire in script.js
• script.js reads form values → executes the “Fijo” module or “Tarifa” module
• Calculation result → script.js writes output back to the DOM
• Styles.css ensures consistent look & feel
Architectural patterns and principles
• Single-page static app (no back-end)
• Modular JS functions for separate calculation concerns
• Clear UI–logic separation: HTML/CSS vs. JavaScript
• Data flow sequence: Input → Compute → Render