How mohit-pr-95/functowerce works
Purpose and Deployment Model
Functowerce is a mostly static educational platform for learning mathematical functions through explanatory content, canvas/SVG visualizations, and a quadratic calculator. The browser frontend is intended for GitHub Pages; a separate Flask service, deployable on Render, supplies calculator results. Core entry points: index.html, quadratic.html, and brain.py.
Main Educational Experience
index.html is the primary learning page: function theory, references, navigation, set-mapping visualization, and graphing UI are rendered as static HTML and enhanced client-side. index2.html is an alternate/archived enhanced layout rather than the primary product route.
• index.html
• index2.html
• style.css
Client Interaction and Visualization Layer
script.js owns browser-side behavior: DOM interaction, responsive/navigation controls, set-to-codomain mapping effects, and interactive graphing. The graphing stage evaluates built-in function definitions in JavaScript and draws grid, axes, curves, and tracked coordinates using browser Canvas; it does not require the API for visualization.
• script.js
• index.html
• style.css
Quadratic Calculator Flow
quadratic.html provides the focused calculator route. User input is validated/collected in the browser, sent as an HTTP GET query parameter (n) to /calculate, and the returned JSON result or error is displayed in the page. This API boundary isolates server-backed calculations from the static frontend.
• quadratic.html
• brain.py
Flask API and Math Engine
brain.py combines the Python mathematical-function library and Flask transport layer. Its primary public endpoints are /calculate, which parses a numeric request and returns the square, and /health, which reports service availability. The module also contains reusable operations such as powers, roots, factorial/floor, and trigonometry that can support future endpoints.
• brain.py
• requirements.txt
Cross-Origin and Runtime Boundary
Frontend and backend are independently hosted origins, so Flask/CORS support is material: the API must permit browser requests from the GitHub Pages frontend. The local development topology is a static HTTP server for HTML/JS/CSS plus a Python 3.7+ Flask process on port 5000; production expects Flask/Gunicorn-compatible hosting on Render.
• brain.py
• requirements.txt
• quadratic.html
Extension Points
New learning pages belong alongside the existing HTML routes; new local grapher functions are added in the client function set in script.js. Server-calculated functions require both a computation function and Flask endpoint in brain.py, followed by a frontend fetch integration. Styling and responsive presentation are centralized in style.css.
• script.js
• brain.py
• style.css
Main entry points: brain.py Flask application · index.html Learning page · quadratic.html Quadratic calculator · script.js Interaction and grapher
Components 14
Static frontend
GitHub Pages-hosted learning experience.
- Learning page · Primary function theory and visualization page.
index.html - Alternate layout · Archived enhanced learning layout.
index2.html - Quadratic calculator · Collects input and displays calculation responses.
quadratic.html - Interaction and grapher · Handles UI, mapping effects, and canvas graphing.
script.js - Local function renderer · Draws grids, curves, and tracked coordinates from built-in functions.
script.js - Shared presentation · Centralizes styling and responsive layout.
style.css
Calculation API
Separately deployable Flask service.
- Flask application · Owns HTTP transport and reusable math operations.
brain.py - GET /calculate · Parses n and returns a JSON result or error.
brain.py - Math operations · Includes square, powers, roots, factorial, floor, and trigonometry.
brain.py - GET /health · Reports service availability.
brain.py - Python dependencies · Provides Flask and deployment dependencies.
requirements.txt
Deployment boundary
Independent browser and Python runtimes.
- Static host · Serves HTML, JavaScript, and CSS.
- API host · Runs the Flask process independently.
- Browser
Connections 15
- Static host → Learning page: serves
- Static host → Quadratic calculator: serves
- Learning page → Interaction and grapher: enhanced by
- Alternate layout → Interaction and grapher: enhanced by
- Interaction and grapher → Local function renderer: renders locally
- Learning page → Shared presentation: uses
- Quadratic calculator → Shared presentation: uses
- Quadratic calculator → GET /calculate: GET n; JSON response · Cross-origin browser request.
- API host → Flask application: runs
- Python dependencies → Flask application: provides runtime packages
- Flask application → GET /calculate: exposes
- Flask application → GET /health: exposes
- GET /calculate → Math operations: uses square operation
- Browser → Static host: loads frontend
- Browser → API host: cross-origin API request · CORS permits requests from the static frontend.