How facundodlf/book-publishing-app works
This is a browser-based book and recipe publishing editor. Users organize a book’s front matter, chapters, recipes, and back matter; edit content and layout; optionally structure pasted recipe text; then preview and export a PDF. The book is held in a client-side Zustand store, with a sample book as initial content. Source excerpts show the main UI and PDF flow; the magic-import API implementation and some helper details were not sampled, so those connections are limited to what the excerpts and source index support.
Main entry points: store.ts Book state · page.tsx Editor shell · editor-area.tsx Book editor · pdf.tsx PDF generator
Components 16
Book workspace
- Editor shell
app/page.tsx - Book structure
components/book/structure-sidebar.tsx
Content authoring
- Book editor
components/book/editor-area.tsx - Rich text editor
components/book/rich-editor.tsx - Style controls
components/book/style-panel.tsx
Recipe imports
- Recipe import
components/book/import-recipe-dialog.tsx - Recipe parser
lib/book/import-recipe.ts - Magic import
components/book/magic-import-dialog.tsx - Magic import API
app/api/magic-import/route.ts
PDF publishing
- PDF preview
components/book/pdf-preview.tsx - PDF generator
lib/book/pdf.tsx - HTML block conversion
lib/book/html-to-blocks.ts
Book model
- Book state
lib/book/store.ts - Book schema
lib/book/types.ts - Sample book
lib/book/sample-book.ts
Other components
- Author
Connections 22
- Author → Editor shell: edits book
README.md - Editor shell → Book structure: renders
app/page.tsx - Editor shell → Book editor: renders
app/page.tsx - Editor shell → Style controls: renders
app/page.tsx - Editor shell → PDF preview: opens preview
app/page.tsx - Book structure → Book state: reads and updates
components/book/structure-sidebar.tsx - Book editor → Book state: reads and updates
components/book/editor-area.tsx - Book editor → Rich text editor: renders
components/book/editor-area.tsx - Book editor → Recipe import: opens
components/book/editor-area.tsx - Book editor → Magic import: opens
components/book/editor-area.tsx - Recipe import → Recipe parser: parses recipe
components/book/import-recipe-dialog.tsx - Recipe import → Book state: updates entry
components/book/import-recipe-dialog.tsx - Magic import → Magic import API: posts text
components/book/magic-import-dialog.tsx - Magic import → Book state: replaces entry
components/book/magic-import-dialog.tsx - Book state → Sample book: initializes from
lib/book/store.ts - Book state → Book schema: uses schema
lib/book/store.ts - Style controls → Book state: updates styles
components/book/style-panel.tsx - Style controls → PDF generator: exports book
components/book/style-panel.tsx - PDF preview → Book state: reads book
components/book/pdf-preview.tsx - PDF preview → PDF generator: generates download
components/book/pdf-preview.tsx - PDF generator → HTML block conversion: converts content
lib/book/pdf.tsx - PDF generator → Book schema: uses schema
lib/book/pdf.tsx