How t3dotgg/unduck works
This project, “Unduck”, is a lightweight, client-side application built to offer much faster bang redirection than DuckDuckGo’s server-side approach. Based on the file tree and README, it’s clear that the project is a front-end focused tool built with modern web technologies (using Vite, TypeScript, and a typical HTML/CSS/JS setup).
Main Components
• Browser Client: The user’s browser serves as the environment where the entire logic will run. This includes the HTML (index.html), CSS (global.css), and the JavaScript/TypeScript code.
• Entry Point and Application Logic: The index.html loads the main bundle (compiled from src/main.ts) which orchestrates the entire process. Note that files like src/bang.ts likely contain the core logic for processing and handling the bang redirection.
• Caching Mechanism: Emphasize that once the page is loaded, the JavaScript gets cached by the browser, reducing subsequent load times.
Relationships and Interactions
• Data Flow: Start with the user entering a query via the custom search engine URL (https://unduck.link?q=%s). The browser loads index.html which, in turn, loads the main bundle.
• Redirect Logic: From main.ts, execution flows to bang.ts which processes the query client-side and performs the redirection.
• Build Process: The Vite build tool takes in all source files (from src, public, etc.) and compiles them into optimized assets that the browser caches.
• External Dependency: Show the relationship with DuckDuckGo’s bang system as the underlying functionality that is being re-implemented client-side for speed benefits.
Architectural Patterns and Design Principles
• Client-side Emphasis: The whole process is executed on the client, reducing reliance on potentially slow server-side redirects.
• Single-Page Application (SPA) Concept: Even though the project is relatively simple, it follows modern SPA design where all logic is loaded upfront and then handled within the browser.
• Progressive Enhancement & Caching: Once loaded initially, the JavaScript is cached, showcasing a design principle aimed at significantly reducing subsequent load times.
Relevant Technologies & Frameworks
• Vite (as the build tool)
• TypeScript (ensured by tsconfig.json and the *.ts files in src)
• CSS for basic styling
• Potential reliance on browser caching mechanisms