How rajin-khan/puffnotes works
Purpose and Runtime
Puffnotes is a Vite-built React single-page markdown editor with two operating modes: private local/offline editing and authenticated Google Drive-backed editing. The browser is the primary runtime; Vercel deployment configuration is present at puffnotes/vercel.json. Application bootstrap flows from puffnotes/src/main.jsx into puffnotes/src/App.jsx.
Application Routing and Mode Selection
puffnotes/src/App.jsx is the top-level state coordinator, selecting marketing/landing, onboarding, offline, or online experiences. puffnotes/src/components/LandingPage.jsx and puffnotes/src/components/MarketingLanding.jsx introduce the product and direct users into a mode. puffnotes/src/components/OnboardingModal.jsx and puffnotes/src/components/OnlineSetupModal.jsx collect mode-specific setup before an editor is entered.
Offline Editing Boundary
Offline mode is implemented by puffnotes/src/components/OfflineApp.jsx and browser-side filesystem access through puffnotes/src/hooks/useFileSystemAccess.js. This establishes a local-first boundary: note content and file interactions stay in the Chromium browser without account or network requirements. The File System Access API is therefore a material browser compatibility constraint.
Online Editing and Cloud Sync
puffnotes/src/components/OnlineApp.jsx is the connected editor surface. It delegates identity/session configuration to puffnotes/src/lib/firebase.js and Drive operations to puffnotes/src/lib/googleDrive.js. Firebase and Google authentication/Google Drive are external service boundaries; online note persistence and multi-device synchronization depend on them rather than a repository-hosted backend.
Authoring, Rendering, and Export Pipeline
The editor flows markdown through live rendering in puffnotes/src/components/MarkdownPreview.jsx. AI enhancement is a separate transformation stage: UI actions invoke puffnotes/src/lib/beautifyWorkflow.js, which accesses Groq through puffnotes/src/lib/groq.js; user-provided API keys support the external Groq boundary. PDF export is handled by puffnotes/src/lib/exportNoteToPdf.jsx, with layout/page splitting logic in puffnotes/src/lib/pdfPagination.js.
Interaction Shell and User Preferences
Shared UI overlays isolate secondary workflows from editor surfaces: settings in puffnotes/src/components/SettingsModal.jsx, shortcuts in puffnotes/src/components/KeyboardShortcutsModal.jsx, and animated modal behavior in puffnotes/src/components/ModalMotion.jsx. Theme selection and persistence are centralized in puffnotes/src/lib/themeManager.js, applied through puffnotes/src/components/ThemeSwitcher.jsx and puffnotes/src/components/ThemeBackground.jsx.
Presentation Assets and Theme System
The visual system is predominantly client-side CSS, rooted in puffnotes/src/App.css and puffnotes/src/index.css, with named theme stylesheets such as puffnotes/src/styles/galaxyTheme.css and puffnotes/src/styles/komorebiTheme.css. Background video assets are statically served from puffnotes/public/, allowing themed/editor visuals without an application media service.
Main entry points: OnlineApp.jsx Online editor · App.jsx App coordinator · OfflineApp.jsx Offline editor · OnboardingModal.jsx Mode setup
Components 20
Browser Application
Vite React single-page runtime.
- React bootstrap
puffnotes/src/main.jsx - App coordinator · Selects landing, setup, offline, or online experiences.
puffnotes/src/App.jsx - Landing experiences
puffnotes/src/components/LandingPage.jsx - Mode setup
puffnotes/src/components/OnboardingModal.jsx - Vercel deployment
puffnotes/vercel.json
Offline Mode
Local-first editing without an account or network.
- Offline editor
puffnotes/src/components/OfflineApp.jsx - File System Access API · Chromium browser compatibility boundary.
puffnotes/src/hooks/useFileSystemAccess.js
Online Mode
Authenticated Google Drive-backed editing.
- Online setup
puffnotes/src/components/OnlineSetupModal.jsx - Online editor
puffnotes/src/components/OnlineApp.jsx - Firebase auth · External Firebase and Google authentication boundary.
puffnotes/src/lib/firebase.js - Google Drive client · Persists notes and enables multi-device sync through Google Drive.
puffnotes/src/lib/googleDrive.js
Authoring Pipeline
- Markdown preview
puffnotes/src/components/MarkdownPreview.jsx - AI beautify workflow
puffnotes/src/lib/beautifyWorkflow.js - Groq client · Uses user-provided API keys for the external Groq service.
puffnotes/src/lib/groq.js - PDF export
puffnotes/src/lib/exportNoteToPdf.jsx - PDF pagination
puffnotes/src/lib/pdfPagination.js
UI and Themes
- Settings and shortcuts
puffnotes/src/components/SettingsModal.jsx - Theme manager
puffnotes/src/lib/themeManager.js - Theme presentation
puffnotes/src/components/ThemeSwitcher.jsx - CSS themes and assets · Client-side styles include named themes; background videos are served from public assets.
puffnotes/src/App.css
Connections 21
- React bootstrap → App coordinator: mounts
- App coordinator → Landing experiences: shows
- Landing experiences → Mode setup: starts mode selection
- App coordinator → Mode setup: opens
- Mode setup → Offline editor: enters offline mode
- Offline editor → File System Access API: reads and writes local files
- App coordinator → Online setup: opens
- Online setup → Online editor: enters online mode
- Online editor → Firebase auth: configures identity and session
- Online editor → Google Drive client: syncs notes
- Offline editor → Markdown preview: renders markdown
- Online editor → Markdown preview: renders markdown
- Online editor → AI beautify workflow: enhances markdown
- AI beautify workflow → Groq client: requests AI completion
- Offline editor → PDF export: exports note
- Online editor → PDF export: exports note
- PDF export → PDF pagination: splits page layout
- App coordinator → Settings and shortcuts: opens secondary workflows
- Settings and shortcuts → Theme manager: updates preference
- Theme presentation → Theme manager: selects theme
- Theme manager → CSS themes and assets: applies visual theme