# mabudalam/quickcrawl architecture

> Architecture diagram of the GitHub repository mabudalam/quickcrawl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mabudalam/quickcrawl
- Repository: https://github.com/mabudalam/quickcrawl

## Overview

1. **What this repository is**
   Quickcrawl is a multi-entrypoint web scraping system written primarily in Go. The core product is a scraping/crawling service that can be used through an HTTP API, a CLI, an MCP server for AI agents, and language SDKs/wrappers.

2. **Core backend boundary**
   The main application logic lives under `internal/`. This is the shared engine used by all interfaces:
   - `internal/api` for HTTP request handling
   - `internal/crawler` for crawl and URL mapping
   - `internal/renderer` for fetch/render decisions
   - `internal/extractor` for content cleanup and formatting
   - `internal/search` for DuckDuckGo search
   - `internal/mcp` for agent-tool exposure
   - `internal/common`, `internal/config`, `internal/types`, `internal/utils` for shared contracts and helpers

3. **Primary request flows**
   All front doors eventually call the same backend pipeline:
   - Client submits a scrape/crawl/map/search request
   - API or MCP layer validates and normalizes it
   - Renderer fetches the page content, either directly over HTTP or through a browser
   - Extractor converts the fetched document into requested outputs such as markdown, HTML, plain text, links, or structured JSON
   - Response is returned to the caller, or in the crawl case persisted/managed as an async job

4. **Rendering architecture**
   The renderer is a distinct subsystem because page acquisition is not always a simple HTTP GET. The repo supports an adaptive path:
   - HTTP fetch first for speed
   - JavaScript rendering when needed
   - Browser-backed rendering through LightPanda or Chrome DevTools Protocol over WebSocket
   - Detection logic decides when a page looks like a SPA or requires browser execution
   This renderer boundary is a key architectural distinction: content acquisition is decoupled from extraction.

5. **Extraction pipeline**
   `internal/extractor` is responsible for turning raw fetched content into consumable formats. It includes:
   - Markdown conversion
   - Plain-text extraction
   - HTML/raw HTML handling
   - Link extraction
   - PDF and plaintext support
   - Chunking and filtering strategies for LLM-style structured extraction
   The extraction layer also supports schema-driven JSON output, so it sits between web content and AI/structured consumers.

6. **Crawler and mapper**
   `internal/crawler` implements site traversal and discovery. The repo’s crawl flow is BFS-oriented with controls for depth, page count, concurrency, and rate limiting. It also integrates:
   - `robots.txt` handling
   - sitemap parsing
   - URL normalization and deduplication
   - asynchronous crawl job management for start/status/cancel operations
   Mapping is the lighter-weight variant that discovers URLs without full content extraction.

7. **Search subsystem**
   `internal/search/duckduckgo.go` provides web search integration. In the architecture, search is not a separate product; it is another input path that can optionally trigger scraping of results. This makes it useful for agent workflows where query, discovery, and content retrieval are chained together.

8. **Interfaces and entrypoints**
   There are multiple independent entrypoints built on the same core:
   - `cmd/server` runs the HTTP API server
   - `cmd/mcp` runs the MCP stdio server
   - `cli/` builds the standalone command-line tool with subcommands for scrape, crawl, map, and search
   This separation matters for architecture diagrams: the “app” is really a shared engine exposed through different transports.

9. **SDKs and external consumers**
   The repo also ships client-facing wrappers:
   - `python/` contains a Python SDK that can run locally via bundled binary or connect to a remote API
   - `npm/` contains a Node wrapper for MCP usage
   These are integration layers, not alternative implementations. They expand distribution and usage surfaces while relying on the Go core.

10. **Playground and observability UI**
    `playground/` is a separate Next.js frontend used to exercise the backend and inspect responses. It has its own API routes for debug/flush operations and a client library for talking to the service. Architecturally, it is a consumer of the server rather than part of the backend runtime.

11. **Configuration, deployment, and packaging**
    The system is configured through `quickcrawl.toml` and environment variables, with config covering server, crawler, renderer, and LLM extraction settings. Deployment artifacts include:
    - `infra/Dockerfile.server` and `infra/Dockerfile.playground`
    - `install.sh` for local installation
    - `goreleaser` config and release scripts for binary packaging
    This indicates the project is designed to ship as a single Go binary plus optional UI/container artifacts.

12. **Non-production supporting systems**
    `bench/` contains benchmark datasets and result scripts, and tests are distributed across core packages, especially renderer, crawler, and extractor. These directories are useful for validating the behavior of the acquisition/extraction pipeline but are not part of the runtime architecture.

Main entry points: [`internal/api`](https://github.com/mabudalam/quickcrawl/tree/main/internal/api) (HTTP API), [`cmd/server/main.go`](https://github.com/mabudalam/quickcrawl/blob/main/cmd/server/main.go) (API server), [`internal/renderer`](https://github.com/mabudalam/quickcrawl/tree/main/internal/renderer) (Renderer), [`internal/crawler`](https://github.com/mabudalam/quickcrawl/tree/main/internal/crawler) (Crawler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_core["Go core"]
  node_node_api["HTTP API<br/>request layer"]
  node_node_crawler["Crawler<br/>crawl engine"]
  node_node_renderer["Renderer<br/>acquisition engine"]
  node_node_extractor["Extractor<br/>content pipeline"]
  node_node_search["Search<br/>discovery source<br/>[duckduckgo.go]"]
  node_node_mcp["MCP bridge<br/>tool adapter"]
  node_node_types["Contracts<br/>shared models"]
end

subgraph group_group_entrypoints["Entrypoints"]
  node_node_cmd_server["API server<br/>Go entrypoint<br/>[main.go]"]
  node_node_cmd_mcp["MCP server<br/>Go entrypoint<br/>[main.go]"]
  node_node_cli["CLI<br/>Go entrypoint<br/>[main.go]"]
end

subgraph group_group_consumers["Consumers"]
  node_node_playground["Playground<br/>Next.js UI"]
  node_node_python["Python SDK<br/>client wrapper"]
  node_node_npm["Node wrapper<br/>client wrapper"]
end

subgraph group_group_support["Support"]
  node_node_config["Config<br/>[quickcrawl.toml]"]
  node_node_infra["Build & deploy<br/>packaging"]
  node_node_bench["Benchmarks<br/>validation data"]
end

node_node_cmd_server -->|"hosts"| node_node_api
node_node_cmd_server -->|"uses"| node_node_renderer
node_node_cmd_server -->|"uses"| node_node_extractor
node_node_cmd_server -->|"uses"| node_node_crawler
node_node_cmd_server -->|"uses"| node_node_search
node_node_cmd_server -->|"shares"| node_node_types
node_node_cmd_mcp -->|"hosts"| node_node_mcp
node_node_cmd_mcp -->|"uses"| node_node_renderer
node_node_cmd_mcp -->|"uses"| node_node_extractor
node_node_cmd_mcp -->|"shares"| node_node_types
node_node_cli -->|"uses"| node_node_renderer
node_node_cli -->|"uses"| node_node_extractor
node_node_cli -->|"uses"| node_node_crawler
node_node_cli -->|"uses"| node_node_search
node_node_api -->|"calls"| node_node_renderer
node_node_api -->|"calls"| node_node_extractor
node_node_api -->|"calls"| node_node_crawler
node_node_api -->|"calls"| node_node_search
node_node_api -->|"shares"| node_node_types
node_node_crawler -->|"depends on"| node_node_renderer
node_node_crawler -->|"shares"| node_node_types
node_node_renderer -->|"shares"| node_node_types
node_node_extractor -->|"shares"| node_node_types
node_node_mcp -.->|"bridges"| node_node_api
node_node_playground -->|"consumes"| node_node_api
node_node_python -->|"connects to"| node_node_cmd_server
node_node_npm -->|"wraps"| node_node_cmd_mcp
node_node_api -.->|"reads"| node_node_config
node_node_crawler -.->|"reads"| node_node_config
node_node_renderer -.->|"reads"| node_node_config
node_node_extractor -.->|"reads"| node_node_config
node_node_infra -.->|"packages"| node_node_cmd_server
node_node_infra -.->|"packages"| node_node_playground
node_node_bench -.->|"evaluates"| node_node_crawler
node_node_bench -.->|"evaluates"| node_node_renderer
node_node_bench -.->|"evaluates"| node_node_extractor

click node_node_cmd_server "https://github.com/mabudalam/quickcrawl/blob/main/cmd/server/main.go"
click node_node_cmd_mcp "https://github.com/mabudalam/quickcrawl/blob/main/cmd/mcp/main.go"
click node_node_cli "https://github.com/mabudalam/quickcrawl/blob/main/cli/main.go"
click node_node_api "https://github.com/mabudalam/quickcrawl/tree/main/internal/api"
click node_node_crawler "https://github.com/mabudalam/quickcrawl/tree/main/internal/crawler"
click node_node_renderer "https://github.com/mabudalam/quickcrawl/tree/main/internal/renderer"
click node_node_extractor "https://github.com/mabudalam/quickcrawl/tree/main/internal/extractor"
click node_node_search "https://github.com/mabudalam/quickcrawl/blob/main/internal/search/duckduckgo.go"
click node_node_mcp "https://github.com/mabudalam/quickcrawl/tree/main/internal/mcp"
click node_node_types "https://github.com/mabudalam/quickcrawl/tree/main/internal/types"
click node_node_playground "https://github.com/mabudalam/quickcrawl/tree/main/playground"
click node_node_python "https://github.com/mabudalam/quickcrawl/tree/main/python/src/quickcrawl"
click node_node_npm "https://github.com/mabudalam/quickcrawl/tree/main/npm"
click node_node_config "https://github.com/mabudalam/quickcrawl/blob/main/quickcrawl.toml"
click node_node_infra "https://github.com/mabudalam/quickcrawl/tree/main/infra"
click node_node_bench "https://github.com/mabudalam/quickcrawl/tree/main/bench"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_api,node_node_crawler,node_node_renderer,node_node_extractor,node_node_search,node_node_mcp,node_node_types toneBlue
class node_node_cmd_server,node_node_cmd_mcp,node_node_cli toneAmber
class node_node_playground,node_node_python,node_node_npm toneMint
class node_node_config,node_node_infra,node_node_bench toneRose
```

## Components

### Go core

Shared scraping engine and backend subsystems

- [HTTP API](https://github.com/mabudalam/quickcrawl/tree/main/internal/api): request layer · Routing, middleware, and handlers for HTTP requests · `internal/api`
- [Crawler](https://github.com/mabudalam/quickcrawl/tree/main/internal/crawler): crawl engine · BFS crawl, map, robots, sitemap, and async job control · `internal/crawler`
- [Renderer](https://github.com/mabudalam/quickcrawl/tree/main/internal/renderer): acquisition engine · Adaptive fetch path across HTTP, browser, and detection · `internal/renderer`
- [Extractor](https://github.com/mabudalam/quickcrawl/tree/main/internal/extractor): content pipeline · Converts fetched documents into markdown, text, HTML, links, or structured output · `internal/extractor`
- [Search](https://github.com/mabudalam/quickcrawl/blob/main/internal/search/duckduckgo.go): discovery source · DuckDuckGo-backed query discovery for later scraping · `internal/search/duckduckgo.go`
- [MCP bridge](https://github.com/mabudalam/quickcrawl/tree/main/internal/mcp): tool adapter · Exposes core actions as MCP tools · `internal/mcp`
- [Contracts](https://github.com/mabudalam/quickcrawl/tree/main/internal/types): shared models · Common types, config, constants, errors, and utilities · `internal/types`

### Entrypoints

Independent runtimes that expose the core

- [API server](https://github.com/mabudalam/quickcrawl/blob/main/cmd/server/main.go): Go entrypoint · HTTP server process for the public API · `cmd/server/main.go`
- [MCP server](https://github.com/mabudalam/quickcrawl/blob/main/cmd/mcp/main.go): Go entrypoint · stdio MCP process for agent tools · `cmd/mcp/main.go`
- [CLI](https://github.com/mabudalam/quickcrawl/blob/main/cli/main.go): Go entrypoint · Command-line interface with scrape, crawl, map, and search commands · `cli/main.go`

### Consumers

Client libraries and UI that use the service

- [Playground](https://github.com/mabudalam/quickcrawl/tree/main/playground): Next.js UI · Interactive frontend for debugging and inspecting responses · `playground`
- [Python SDK](https://github.com/mabudalam/quickcrawl/tree/main/python/src/quickcrawl): client wrapper · Python client that can use a local binary or remote API · `python/src/quickcrawl`
- [Node wrapper](https://github.com/mabudalam/quickcrawl/tree/main/npm): client wrapper · Node package for MCP usage · `npm`

### Support

Packaging, deployment, and benchmarking

- [Config](https://github.com/mabudalam/quickcrawl/blob/main/quickcrawl.toml): runtime config · TOML and environment-based configuration for server, crawler, renderer, and extraction · `quickcrawl.toml`
- [Build & deploy](https://github.com/mabudalam/quickcrawl/tree/main/infra): packaging · Dockerfiles, installer, and release tooling · `infra`
- [Benchmarks](https://github.com/mabudalam/quickcrawl/tree/main/bench): validation data · Benchmark datasets, scripts, and result artifacts · `bench`

## Connections

- API server → HTTP API: hosts · Runs the HTTP API layer
- API server → Renderer: uses · Delegates page acquisition to the renderer
- API server → Extractor: uses · Formats responses through the extractor
- API server → Crawler: uses · Handles crawl and map operations through the crawler
- API server → Search: uses · Supports search-driven discovery requests
- API server → Contracts: shares · Relies on shared contracts and helpers
- MCP server → MCP bridge: hosts · Runs the MCP tool server
- MCP server → Renderer: uses · Acquires content for agent tools
- MCP server → Extractor: uses · Produces tool outputs from fetched content
- MCP server → Contracts: shares · Uses shared request and response models
- CLI → Renderer: uses · Scrape command reaches the acquisition pipeline
- CLI → Extractor: uses · CLI formats content through the extractor
- CLI → Crawler: uses · Crawl and map commands use site traversal
- CLI → Search: uses · Search command invokes discovery
- HTTP API → Renderer: calls · Fetches pages through adaptive rendering
- HTTP API → Extractor: calls · Transforms content into output formats
- HTTP API → Crawler: calls · Starts and manages crawl/map jobs
- HTTP API → Search: calls · Supports search-based workflows
- HTTP API → Contracts: shares · Uses shared contracts, config, and utilities
- Crawler → Renderer: depends on · Crawl and scrape paths need page acquisition
- Crawler → Contracts: shares · Uses shared job and URL models
- Renderer → Contracts: shares · Uses shared fetch and render types
- Extractor → Contracts: shares · Uses shared extraction types and schemas
- MCP bridge → HTTP API: bridges · Tool adapter maps agent calls onto core operations
- Playground → HTTP API: consumes · Debug UI talks to the backend service
- Python SDK → API server: connects to · Can call the remote HTTP service or use a bundled binary
- Node wrapper → MCP server: wraps · Provides a Node client around MCP usage
- HTTP API → Config: reads · Loads runtime configuration
- Crawler → Config: reads · Uses crawl-specific limits and settings
- Renderer → Config: reads · Uses renderer and browser settings
- Extractor → Config: reads · Uses extraction and LLM-related settings
- Build & deploy → API server: packages · Builds server container and release artifacts
- Build & deploy → Playground: packages · Builds playground container image
- Benchmarks → Crawler: evaluates · Benchmark data measures crawl and scrape behavior
- Benchmarks → Renderer: evaluates · Benchmarks acquisition quality and speed
- Benchmarks → Extractor: evaluates · Benchmarks extraction outputs and formats
