How adalinger/enzyme-calculator works
Project type + purpose (from file tree + README)
This is a single-page frontend web application (SPA) implemented in React + TypeScript. Its purpose is narrowly scoped: a pancreatic enzyme dosage calculator. There is no backend service in the repository and no database; all computation and UI happen in the browser. Deployment target is GitHub Pages (static hosting).
What the file structure implies architecturally
Key directories/files:
• public/
Static assets and HTML shell:
• public/index.html is the SPA entry document where the React bundle mounts.
• manifest.json, robots.txt are typical CRA (Create React App) artifacts.
• src/
The entire application code:
• src/index.tsx: React bootstrap (renders <App /> into DOM).
• src/main/App.tsx: top-level application component (composition/root UI).
• src/main/Calculator.tsx: the calculator UI + logic (domain functionality).
• src/index.css: global styling.
• src/reportWebVitals.ts: performance instrumentation (optional).
• src/setupTests.ts: testing setup (Jest/RTL baseline).
• src/react-app-env.d.ts: TypeScript/CRA typings.
• package.json, package-lock.json, tsconfig.json: build tooling, dependencies, TypeScript config.
• Deployment is indicated by README: npm run deploy to GitHub Pages (commonly via gh-pages).
Architectural pattern: client-only, component-based UI, with calculator logic most likely living inside Calculator.tsx (or as helper functions inside it). No explicit state management library present in tree; likely React local state.
What the README adds
• Confirms runtime: React.
• Confirms hosting: GitHub Pages.
• Confirms lifecycle: start/test/build/deploy scripts.
User + Browser runtime
• “End User”
• “Web Browser (React SPA runtime)”
Static hosting
• “GitHub Pages (static site hosting + CDN-like delivery)”
App shell + React entry
• public/index.html (mount point)
• src/index.tsx (bootstraps React, renders App)
UI component hierarchy
• App.tsx (root component)
• Calculator.tsx (core feature component)
Domain logic / calculation
• “Enzyme dosage calculation logic” (even if embedded in Calculator.tsx, represent it as a subcomponent/module for clarity)
Observability (optional but real)
• reportWebVitals.ts (performance metrics; show as optional path)
Build & deploy toolchain
• “Node.js + npm scripts”
• “React build pipeline (CRA / webpack under the hood)”
• “Build artifacts (static JS/CSS bundle)”
• “Deploy script → GitHub Pages”
Test tooling (engineering view)
• “Jest/React Testing Library (via setupTests.ts)”
Runtime flow (what users experience):
index.tsx → renders App.tsx → contains/instantiates Calculator.tsx
6. User inputs in Calculator UI → Calculator state updates → calculation logic runs → UI renders results
Build/deploy flow (what engineers do):
1. Engineer → npm run build → build toolchain → outputs static assets (build/ directory conceptually)
Engineer → npm run deploy → publishes build output → GitHub Pages
Optional telemetry flow (if enabled):
• Browser app → reportWebVitals.ts → (potential) external analytics endpoint
If the project doesn’t configure an endpoint, show it as “optional / not configured”.
Architectural patterns/design principles present
• SPA + static hosting: no server-side rendering, no API dependency.
• Component-based architecture: React components compose UI.
• Separation of concerns (lightweight):
• Entry/bootstrap (index.tsx)
• Root composition (App.tsx)
• Feature module (Calculator.tsx)
• Styling (index.css)
• Deterministic domain logic: calculator computations are pure-ish and should be isolated (even if currently co-located).
Technologies that should be explicitly labeled
• React, TypeScript
• GitHub Pages
• Node.js/npm (for build/test/deploy)
• Jest/testing setup (for dev workflow view)