This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
App Store Screenshot Generator - a browser-based tool for creating App Store marketing screenshots. Built with vanilla JavaScript, HTML5 Canvas, Three.js, and CSS. No build process required.
Development Server:
- The agent should automatically start the local development server when needed using
python3 -m http.server 8000(ornpx serve .as fallback) - The agent should run the server in the background and inform the user which URL to open (e.g.,
http://localhost:8000) - The agent should NOT ask the user to start the server manually
- The agent should monitor server logs to detect and report any errors or problems to the user
Git & Commits:
- The agent should handle all git operations automatically (add, commit, push)
- Before creating a commit, the agent MUST show the proposed commit message to the user and wait for approval
- Only after user approval should the agent proceed with the commit
- The agent should follow standard git commit message conventions
To run locally, serve via a web server (required for IndexedDB persistence):
python3 -m http.server 8000
# or
npx serve .Open http://localhost:8000 in browser. Opening index.html directly from filesystem will break persistence.
Main files:
index.html- UI structure with modals for settings, about, project management, translations, and language selectionstyles.css- Dark theme styling, responsive layout with CSS Grid (3-column: left sidebar, canvas, right sidebar)app.js- All application logic (~4400 lines)three-renderer.js- Three.js 3D rendering for iPhone mockups (~1000 lines)language-utils.js- Language detection, localized image management, and translation dialogs (~500 lines)
Key patterns in app.js:
stateobject at top holds all application state (screenshots, settings, text, background config)updateCanvas()is the main render function - call after any state changesaveState()persists to IndexedDB, called automatically inupdateCanvas()syncUIWithState()updates all UI controls to reflect current state- Project management uses IndexedDB with two stores:
projects(data) andmeta(project list) - Per-screenshot settings: each screenshot stores its own background, device, and text settings
Canvas rendering pipeline (in updateCanvas):
drawBackground()- gradient/solid/image with optional blur and overlaydrawScreenshot()- positioned, scaled, rotated screenshot with shadow and borderdrawText()- headline and subheadline with multi-language supportdrawNoise()- optional noise texture overlay
3D rendering (in three-renderer.js):
- Uses Three.js with GLTFLoader for iPhone 15 Pro Max model
initThreeJS()- initializes scene, camera, renderer, and lightsloadPhoneModel()- loads the 3D iPhone model frommodels/iphone-15-pro-max.glbrenderThreeJSToCanvas()- renders 3D scene to export canvas with full resolutionrenderThreeJSForScreenshot()- renders 3D for specific screenshot (side previews)- Drag-to-rotate interaction on the 3D preview canvas
Multi-language text:
state.text.headlinesandstate.text.subheadlinesare objects keyed by language codegetTextSettings()returns either global or per-screenshot text depending on toggle state- AI translation calls Claude/OpenAI/Google API directly from browser (requires API key in settings)
Localized screenshots (in language-utils.js):
- Each screenshot has
localizedImagesobject keyed by language code (e.g.,{ 'en': {...}, 'de': {...} }) detectLanguageFromFilename()- parses suffixes like_de,-fr,_pt-brfrom filenamesgetScreenshotImage(screenshot)- returns image for current language with fallback chainfindScreenshotByBaseFilename()- matches uploads to existing screenshots by base name- Duplicate detection shows dialog with Replace/Create New/Skip options when uploading matching files
UI Components:
- Right sidebar has three tabs: Background, Device, Text
- Collapsible toggle sections for Noise, Shadow, Border, Headline, Subheadline
- Device tab has 2D/3D mode selector with different controls for each mode
- Side preview carousel with sliding animation between screenshots
- Project selector dropdown with screenshot counts
- Gradient editor with draggable color stops
Project & Screenshots (app.js):
createProject()/deleteProject()/switchProject()- async, must await and callupdateProjectSelector()afterhandleFiles()- processes uploaded images, detects language, shows duplicate dialog if neededcreateNewScreenshot()- creates screenshot entry with localized image supportexportCurrent()/exportAll()- generates PNG downloads from canvas (ZIP for batch export)applyPositionPreset()- applies preset screenshot positioning (centered, bleed, tilt, perspective, etc.)transferStyle()- copies style settings from one screenshot to anotherslideToScreenshot()- animates carousel transition between screenshotsupdateSidePreviews()- renders adjacent screenshots in side preview canvases
Language Utils (language-utils.js):
detectLanguageFromFilename()- extracts language code from filename suffixesgetBaseFilename()- strips language suffix and extension for matchingfindScreenshotByBaseFilename()- finds existing screenshot with same base namegetScreenshotImage()- returns localized image for current language with fallbacksaddLocalizedImage()/removeLocalizedImage()- manage per-language imagesshowDuplicateDialog()- async dialog for handling duplicate uploadsshowExportLanguageDialog()- dialog for choosing export scope (current/all languages)
- Three.js (r128) - 3D rendering for device mockups
- GLTFLoader - loads iPhone 3D model
- JSZip - creates ZIP files for batch export
- Google Fonts API - font picker with 1500+ fonts