How jyen2k/tax-diagram-tool works
1. What this repo is
This is a lightweight, mostly client-side browser app for building tax structure diagrams. The main product surface is the diagram editor; the only meaningful backend responsibility is serving the app and accepting feedback submissions.
2. Top-level split
The repository is organized around two browser entry points:
- index.html for the diagram builder
- feedback.html for the internal feedback form
Supporting logic lives in app.js and feedback.js, with shared styling in styles.css.
3. Main editor boundary
The core architecture is a single-page, JavaScript-driven editor rendered in the browser. The UI appears to be built without a heavyweight frontend framework, using plain HTML/CSS/JS plus static vendor libraries under vendor/.
4. Diagram model and interaction flow
The diagram tool likely maintains an in-browser state model for entities, ownership relationships, and transaction arrows. User actions such as drag-and-drop, editing in the inspector panel, and switching relationship modes all feed into that state, which then drives the SVG canvas rendering.
5. Tax-specific semantics
The repository is not a generic diagram app; the entity palette is tax-domain specific. It supports corporations, partnerships, hybrid/disregarded entities, trusts/non-entities, and individuals, so the model likely distinguishes node types and relationship types in a way that supports tax-structure notation.
6. Rendering and output
The canvas is SVG-based, which is important architecturally because it enables both interactive editing and export. The same diagram state can be saved in-browser and exported as SVG, PNG, and editable PPTX, indicating a client-side export pipeline rather than server-side rendering.
7. Persistence boundary
Regular editor state is stored in the browser, so the app can run with minimal backend dependence. That makes the browser the primary system of record for drafts, with export files acting as the portable output format.
8. Narrative generation
The “plain-English structure descriptions” feature suggests a second derived view over the same diagram model: the editor state is transformed into narrative text for lawyers. This is likely computed locally in the client, not via a separate service.
9. Feedback subsystem
Feedback is a separate internal workflow, not part of the main editor loop. feedback.html/feedback.js capture a comment plus a PNG snapshot of the current diagram, and can include the authenticated user email when the platform provides it.
10. Backend/API boundary
server.py is the lightweight backend entrypoint. Based on the README, it serves the browser app and provides a feedback API. Feedback is persisted either to local storage on disk under /tmp/tax-flow-chart-feedback or to Postgres when DATABASE_URL is present.
11. Deployment/runtime
The Dockerfile and .appgarden.json show the app is designed for App Garden deployment. The container runs the web app and feedback API on the platform-provided PORT, with internal auth enabled when used as a teammate-facing tool.
12. External dependencies
The only external infrastructure that materially changes the architecture is managed Postgres for feedback storage and App Garden authentication headers. Everything else — editing, rendering, and export — is handled in the browser.
13. How to draw the architecture
A good diagram would show:
- Browser UI as the primary application boundary
- Static assets and client-side logic as the main engine
- A small Python server behind it for serving files and feedback submission
- Optional Postgres persistence for feedback only
- No server-side involvement in normal diagram editing/export workflows
Main entry points: server.py Python server · index.html Diagram editor · feedback.js Feedback logic · app.js Editor logic
Components 19
Browser app
Client-side diagram editor and shared UI assets
- Diagram editor · Main tax-structure diagram builder surface
index.html - Editor logic · Primary browser-side controller for state, interactions, and rendering
app.js - Shared styles · Common visual styling for the browser UI
styles.css - Vendor libs · Bundled third-party browser libraries used by the editor
vendor - Diagram model · In-browser representation of entities, relationships, and transactions
- Editor tools · Drag, edit, mode switching, and inspector-driven updates
- SVG canvas · Interactive SVG drawing surface for the diagram
- Export pipeline · Client-side export to SVG, PNG, and editable PPTX
- Narrative text · Plain-English description generation from diagram state
- Local drafts · Persistent browser-side storage for editor state
Feedback flow
Separate internal feedback capture workflow
- Feedback form · Internal feedback submission page
feedback.html - Feedback logic · Captures comment, snapshot, and user identity when available
feedback.js - PNG snapshot · Image capture of the current diagram included with feedback
Backend
Small Python server and persistence boundary
- Python server · Serves the browser app and accepts feedback submissions
server.py - Feedback API · Backend endpoint for storing feedback payloads
- Disk store · Local on-disk feedback persistence under /tmp/tax-flow-chart-feedback
- Postgres · Optional managed persistence for feedback when DATABASE_URL is set
Deployment
Container and platform runtime configuration
- Container · Container image definition for App Garden deployment
Dockerfile - App config · Platform deployment and runtime settings
.appgarden.json
Connections 19
- Diagram editor → Editor logic: loads · Browser entry bootstraps the main editor logic
- Diagram editor → Shared styles: uses · Main app shares the common stylesheet
- Diagram editor → Vendor libs: bundles · Editor depends on static third-party browser libraries
- Editor logic → Diagram model: updates · User actions mutate the diagram state model
- Editor tools → Diagram model: edits · Inspector, drag-and-drop, and mode changes feed the model
- Diagram model → SVG canvas: drives · State changes re-render the SVG canvas
- SVG canvas → Export pipeline: feeds · Rendered diagram state is exported to file formats
- Diagram model → Narrative text: derives · Same diagram state is transformed into plain-English structure text
- Diagram model → Local drafts: persists · Draft editor state is stored locally in the browser
- Feedback form → Feedback logic: loads · Feedback page bootstraps the feedback client logic
- Feedback logic → PNG snapshot: captures · Feedback submission includes a PNG of the current diagram
- Feedback logic → Python server: submits · Feedback client posts submissions to the backend
- Python server → Feedback API: exposes · Backend provides the feedback submission endpoint
- Feedback API → Disk store: stores · Fallback persistence writes feedback to local disk
- Feedback API → Postgres: stores · Optional persistence writes feedback to Postgres
- Container → Python server: packages · Container image runs the Python web server
- App config → Python server: configures · Platform config sets runtime and port behavior
- Python server → Diagram editor: serves · Backend serves the main browser application
- Python server → Feedback form: serves · Backend serves the feedback form page