How mizcausevic-dev/promptforge works
Purpose and principal workflow
PromptForge is a browser-only collaborative prompt library: people browse approved prompts, fill named variables, preview and copy resolved text, and create versioned revisions for review. The initiating actor is a Browser user; the HTML shell loads the application, which routes interactions through a single-page UI and persists the shared data model in browser storage. Mock model responses are stored demo results, not calls to model providers.
Components
Browser application
• Browser user — null — Uses the prompt library, edits and tests prompts, and can switch among client-side mock accounts; there is no real authentication.
• HTML shell — index.html — Hosts the SPA and its browser-side assets.
• SPA controller and router — app.js — Owns initialization, hash routing, event handling, shared state, and rendering of route-selected views; README documents routes including browse, prompt detail, editing, folders, and moderation.
• Prompt data and demo fixtures — seed.js — Supplies mock users and initial prompts, versions, comments, test cases, folders, and favorites through window.PF_SEED.
Prompt library and editing
• Discovery and prompt detail — app.js — Supports public browsing, search and filters, prompt detail, version history, attribution, comments, variable forms, and resolved previews; the excerpt shows search over title, current body, category, tags, and author.
• Prompt authoring and versioning — app.js — Handles creation and revision editing; README documents that saves preserve earlier bodies as versions, and the excerpt shows a live preview while editing.
• Variable resolution and copy validation — app.js — Extracts named variables, fills previews, and validates missing values before copy, as documented and reflected in the exported pure-logic test API.
• Organization and user activity — app.js — Manages favorites, folders, tags, and upvotes; the excerpt shows favorite and upvote mutations followed by persistence and rerendering.
• Moderation workflow — app.js — Implements draft, pending, approved, and flagged states, with admin actions and non-approved prompts excluded from public browse according to the README.
Evaluation and data exchange
• Test-case evaluation — app.js — Stores per-prompt cases and mock responses for version comparisons; the excerpt wires “run test” actions, and README describes side-by-side PASS/FAIL results and reruns.
• Import, export, and data validation — app.js — Provides JSON exchange and validates/merges imported data; the sampled framework-free test file exercises validation and merge behavior.
• Browser persistence and migration — app.js — Maintains the application database in browser storage and includes a schema migration chokepoint; README identifies localStorage key promptforge.db.v1 as the persistence mechanism.
Relationships
• Browser user -> HTML shell: opens the application in a browser; README documents opening index.html directly or serving it.
• HTML shell -> SPA controller and router: hosts the SPA entry point; README identifies the shell and application files.
• SPA controller and router -> Prompt data and demo fixtures: initializes demo data from window.PF_SEED on first run, as documented by the seed module.
• SPA controller and router -> Browser persistence and migration: loads and saves application state; README documents localStorage persistence and the source excerpt shows migration and storage helpers.
• Browser user -> SPA controller and router: navigates routes and triggers UI actions through browser interaction; the excerpt shows global event handling and hash-based routing is documented.
• SPA controller and router -> Discovery and prompt detail: renders route-selected library views; README documents browsing and detail capabilities.
• Discovery and prompt detail -> Variable resolution and copy validation: resolves prompt variables for preview and validates missing values before copying; README documents this detail-page workflow.
• Browser user -> Prompt authoring and versioning: submits prompt creations or revisions through the editor; the excerpt shows the save action and README documents versioned saves.
• Prompt authoring and versioning -> Browser persistence and migration: persists prompt mutations through the application state path; the excerpt shows mutation handlers calling saveDB().
• Browser user -> Moderation workflow: admin actions approve or flag prompts; the excerpt shows approve and flag controls.
• Moderation workflow -> Browser persistence and migration: persists moderation changes through the application’s save path; README documents moderation states and the excerpt wires moderation actions.
• Browser user -> Test-case evaluation: runs test cases from the prompt detail view; the excerpt binds run-test controls.
• Test-case evaluation -> Browser persistence and migration: stores test-case results with prompt state; README documents per-prompt test cases and reruns.
• Browser user -> Organization and user activity: toggles favorites and upvotes or organizes prompts; the excerpt shows those actions.
• Organization and user activity -> Browser persistence and migration: saves these state mutations; the excerpt shows saveDB() after favorite and upvote changes.
• Browser user -> Import, export, and data validation: initiates JSON exchange; README documents import/export.
• Import, export, and data validation -> Browser persistence and migration: merges validated import data into application state; the sampled tests exercise mergeImport and schema-version stamping.
Coverage limits
The app.js sample omits substantial sections, so exact initialization order, storage fallback details, and several action implementations cannot be confirmed. README documents features not fully visible in the excerpts; relationships above distinguish that documentation from direct source evidence. No external model provider, server, or real identity system is established.
Main entry points: app.js Browser persistence and migration · index.html HTML shell · seed.js Prompt data and demo fixtures
Components 12
Browser Runtime
SPA entry point and demo data.
- HTML shell
index.html - SPA controller and router
app.js - Prompt data and demo fixtures
seed.js
Prompt Workflows
Library, authoring, organization, and moderation features.
Evaluation & Data
Test evaluation, JSON exchange, and browser persistence.
Other components
- Browser user
Connections 17
- Browser user → HTML shell: opens
- HTML shell → SPA controller and router: hosts
- SPA controller and router → Prompt data and demo fixtures: initializes from
- SPA controller and router → Browser persistence and migration: loads and saves
- Browser user → SPA controller and router: interacts with
- SPA controller and router → Discovery and prompt detail: renders views
- Discovery and prompt detail → Variable resolution and copy validation: resolves and validates
- Browser user → Prompt authoring and versioning: submits edits
- Prompt authoring and versioning → Browser persistence and migration: persists changes
- Browser user → Moderation workflow: moderates prompts
- Moderation workflow → Browser persistence and migration: persists changes
- Browser user → Test-case evaluation: runs tests
- Test-case evaluation → Browser persistence and migration: stores results
- Browser user → Organization and user activity: organizes prompts
- Organization and user activity → Browser persistence and migration: persists changes
- Browser user → Import, export, and data validation: exchanges JSON
- Import, export, and data validation → Browser persistence and migration: merges imported data