A webapp to keep track of all your cursed prompts
README.md

Promptbook #

A browser-only prompt journal: save the prompts you write for AI models, file them in nested projects, tag them, label the model, and find them again. No backend: everything lives in your browser.

journal

Built from ../promptbook.pen (design) and ../REQUIREMENTS.md (PRD).

Run #

Needs Deno 2.x. From promptbook-app/:

deno install      # fetch dependencies into node_modules/
deno task dev     # http://localhost:5173
deno task build   # static site in dist/, host anywhere
deno task preview # serve dist/
deno task check   # strict TypeScript check
deno task lint
deno task test    # unit tests for the router, library and project tree

Dev helper (development builds only): promptbookSeed(90) in the console adds sample prompts, projects, tags and models.

Stack #

  • TypeScript (strict) on Deno, which runs Vite for the dev server and build. Shared data types live in src/core/types.ts.
  • Lit web components, rendered into light DOM so Bulma styles apply. @lit/context provides the library and the current route.
  • A plain JSON library object as the single source of truth, saved to localStorage and reloaded when another tab saves.
  • IBM Plex Sans and Mono via @fontsource; icons from lucide.
  • Design tokens in src/styles/tokens.css mirror the .pen variables (Style Guide frame).

TypeScript conventions #

  • Lit reactive properties are listed in static properties and declared with declare (e.g. declare route: Route;), then initialised in the constructor. A plain class field would shadow Lit's accessor and break updates. Non-reactive members can be ordinary fields.
  • Custom events have a named detail type next to the element that emits them (ComboboxChange, TagsChange, PromptSaved, …); handlers annotate CustomEvent<…>.
  • Modules imported by tests must not import CSS (Deno can't load it), so shared types go in src/core/types.ts.
  • Don't run deno fmt: it reformats the HTML inside Lit templates, where whitespace can be visible.

Layout: one folder per feature #

Each feature is a vertical slice: its data operations, components and CSS live together.

Folder Feature
src/core/ Shared plumbing: library + persistence, router, lazy lists, popovers, combobox, filters, toasts
features/composer Inline prompt composer (never a modal); also edits prompts. mobile-composer.ts is the phone version
features/journal Journal grouped by day, date navigation, project filter
features/prompts Prompt data, the prompt card (used in every list, always fully expanded), @reference highlighting, edit/delete menu
features/projects Nested projects: tree, page, breadcrumbs, picker
features/tags Tag pills, pill input with suggestions, tag filter
features/models Model picker, model tag, sidebar filter, model detection from pasted prompts
features/starred Star toggle and Starred view
features/search Search field (⌘K), results with tabs and highlighted matches
features/settings, features/library-io Settings, JSON export/import (also by dropping a file anywhere), storage usage

Phones #

One responsive app: at a viewport of 720px or less (MOBILE_QUERY in src/core/viewport.ts, mirrored by @media (max-width: 720px) blocks in each feature's CSS) the shell swaps the sidebar for a top bar. Its brand button drops the sidebar down inline under the bar; "+" starts a prompt. Pages stack, and prompt cards move their actions next to the model tag. Form fields use 16px text on phones, so iOS doesn't zoom in on them.

The phone composer (<pb-mobile-composer>, a subclass of <pb-composer>) replaces the page while open and works in three stages:

  1. Paste: "+" reads the clipboard during the tap. Browsers that allow it skip straight to stage 2. Otherwise (iOS, or permission not granted) a big "Paste from clipboard" button asks again. Typing in the field below goes straight to stage 3.
  2. Preview: the clipboard as it will be saved, with @references and the detected model. "Use this prompt" or "Not this".
  3. Details: the full form with a "Pasted from clipboard · Undo" bar and a save bar at the bottom. Editing a prompt opens here.

Both composers fill in a title (the first sentence, shortened) and, for Midjourney syntax such as --ar 16:9 or --v 6.1, the model, unless you picked one yourself. If the window crosses the breakpoint mid-draft, the draft carries over.

Export format #

Export library downloads one JSON file:

{
  "format": "promptbook",
  "version": 1,
  "exportedAt": "2026-10-31T18:00:00.000Z",
  "settings": { "libraryName": "Promptbook", "defaultModel": "" },
  "projects": [{ "id": "…", "path": "Acme / Website", "name": "Website", "parentId": "…", "description": "" }],
  "models": ["…"],
  "prompts": [{ "id": "…", "title": "…", "body": "…", "projectId": "…", "tags": ["#hero"], "model": "…", "starred": false, "createdAt": 0, "updatedAt": 0 }]
}

The hierarchy is parentId; path is included for readability. Settings → Import library replaces the library with a file in this format, after an inline confirmation. Dropping the file anywhere in the app does the same (features/library-io/drop-import.ts, mounted in the shell): while files are dragged over the window a full-window drop zone shows, the file is checked with the same validation, and the same confirmation is pinned to the top of the main area. This works on every page, even while composing, and the draft is kept. An invalid file only shows an error toast; of several files, the first .json is used. Older exports with author or members fields still import; those fields are ignored.

Storage #

localStorage holds about 5 MB per site. Settings shows how much is used, so export regularly. If two tabs edit at once, the last save wins.