How ajayrajpurohit/chat-gpt works
Project Type and Purpose
• This is an open-source, client-side “bookmarklet” tool for saving ChatGPT conversations as standalone HTML files.
• It consists of a static web page (index.html) that hosts the bookmarklet (bookmark.js) plus example saved conversation files in dated folders.
File Structure Analysis
• Top-level:
• index.html – landing page with instructions and the bookmarklet link
• bookmark.js – the bookmarklet script the user drags into their browser
• LICENSE, README.md – project metadata
• 12-2022/…, 03-2023/… – example saved HTML conversations
• No backend or server-side code. No build scripts or config files beyond standard static assets.
README Insights
• Purpose: let users “save ChatGPT conversation as HTML file on disk.”
• Notes an interesting integration: uploading saved chats to Amazon S3.
• Encourages contributions and bug reports.
Main Components
a. User’s Web Browser
b. Static Hosting (GitHub Pages or any static file server) serving index.html + bookmark.js
c. Bookmarklet Script (bookmark.js) injected into ChatGPT’s page context
d. Browser DOM of the ChatGPT page (source of the conversation data)
e. Local File System (where the generated HTML is downloaded)
f. Optional External Service: Amazon S3 (via fetch API)
Relationships & Data Flows
• User visits index.html → drags the bookmarklet to their toolbar.
• On ChatGPT page, user clicks the bookmarklet → browser injects bookmark.js into that page.
• bookmark.js reads the conversation DOM → serializes it into an HTML blob.
• Script triggers a browser download → file saved to local disk (12-2022/, 03-2023/ folders in examples).
• (Optional) bookmark.js can POST the same blob to an S3 bucket via AWS SDK or signed URL.
Architectural Patterns & Design Principles
• Pure client-side, zero-backend architecture.
• Bookmarklet pattern: small JavaScript snippet injected at runtime.
• Extensibility point: ability to add upload handlers (e.g., S3, Dropbox).
• Separation of concerns: index.html for distribution, bookmark.js for core logic.
Key Technologies & Libraries
• Vanilla JavaScript for the bookmarklet logic.
• HTML5 Blob and download API.
• (Optional) AWS S3 REST API or AWS SDK for JavaScript.