# apify/actor-templates architecture

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

- Interactive diagram: https://gitdiagram.com/apify/actor-templates
- Repository: https://github.com/apify/actor-templates

## Overview

This repository is a catalog of Apify Actor starter templates, rather than a single running application. The principal workflow is that a developer uses Apify CLI to select a template, which bootstraps a project that can then run as an Actor; the README also describes fetching a template manifest through the package API. The catalog spans basic projects, web crawlers, browser automation, AI agents, MCP servers, and a Playwright test runner. Some template internals are unsampled, so their capabilities are represented without inferred call chains.

Main entry points: [`templates/python-mcp-proxy/my_actor/server.py`](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/server.py) (Python MCP proxy), [`templates/ts-beeai-agent/src/main.ts`](https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/main.ts) (BeeAI agent), [`templates/ts-mcp-proxy/src/server.ts`](https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/server.ts) (TypeScript MCP server), [`templates/python-mcp-proxy/my_actor/mcp_gateway.py`](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/mcp_gateway.py) (MCP gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Template catalog"]
  node_basics["Starter projects<br/>[main.js]"]
  node_empty["Empty projects<br/>[main.js]"]
  node_template_api["Manifest API<br/>[index.js]"]
end

subgraph group_scraping["Scraping and browsers"]
  node_cheerio_crawlers["Cheerio crawlers<br/>[routes.js]"]
  node_browser_crawlers["Browser crawlers<br/>[main.js]"]
  node_python_crawlers["Python crawlers<br/>[main.py]"]
  node_scrapy_items["Scrapy items<br/>[items.py]"]
  node_scrapy_pipeline["Scrapy pipeline<br/>[pipelines.py]"]
end

subgraph group_agents["AI agent examples"]
  node_browser_use["Browser Use agent<br/>[main.py]"]
  node_browser_config["Browser configuration<br/>[config.py]"]
  node_browser_compat["Signal compatibility<br/>[compat.py]"]
  node_langchain["LangChain retrieval<br/>[main.js]"]
  node_vector_cache[("Vector index cache")]
  node_bee_agent["BeeAI agent<br/>[main.ts]"]
  node_structured_output["Structured output"]
  node_calculator_tool["Calculator tool<br/>[calculator.ts]"]
  node_instagram_tool["Instagram tool<br/>[instagram.ts]"]
end

subgraph group_services["Protocols and tools"]
  node_python_mcp["Python MCP proxy<br/>[server.py]"]
  node_mcp_gateway["MCP gateway<br/>[mcp_gateway.py]"]
  node_mcp_events[("MCP event store<br/>[event_store.py]")]
  node_mcp_models["MCP models<br/>[models.py]"]
  node_mcp_constants["MCP policy constants<br/>[const.py]"]
  node_ts_mcp["TypeScript MCP server<br/>[server.ts]"]
  node_ts_billing["Message billing<br/>[billing.ts]"]
  node_ts_mcp_protocol["MCP protocol handlers<br/>[mcp.ts]"]
  node_playwright_runner["Playwright test runner<br/>[main.ts]"]
  node_playwright_transform["Report transformation<br/>[transform.ts]"]
end

node_developer(("Developer"))
node_cli{{"Apify CLI"}}

node_developer -->|"selects template"| node_cli
node_cli -->|"bootstraps project"| node_basics
node_cli -->|"bootstraps project"| node_empty
node_developer -->|"fetches manifest"| node_template_api
node_scrapy_pipeline -->|"processes items"| node_scrapy_items
node_langchain -->|"caches index"| node_vector_cache
node_bee_agent -->|"generates output"| node_structured_output
node_bee_agent -->|"invokes tool"| node_calculator_tool
node_bee_agent -->|"invokes tool"| node_instagram_tool
node_python_mcp -->|"routes requests"| node_mcp_gateway
node_python_mcp -->|"tracks events"| node_mcp_events
node_python_mcp -->|"uses models"| node_mcp_models
node_python_mcp -->|"uses constants"| node_mcp_constants
node_mcp_gateway -->|"filters tools"| node_mcp_constants
node_ts_mcp -->|"charges messages"| node_ts_billing
node_ts_mcp -->|"handles protocol"| node_ts_mcp_protocol
node_playwright_runner -->|"transforms report"| node_playwright_transform

click node_basics "https://github.com/apify/actor-templates/blob/master/templates/js-start/src/main.js"
click node_empty "https://github.com/apify/actor-templates/blob/master/templates/js-empty/src/main.js"
click node_template_api "https://github.com/apify/actor-templates/blob/master/src/index.js"
click node_cheerio_crawlers "https://github.com/apify/actor-templates/blob/master/templates/js-crawlee-cheerio/src/routes.js"
click node_browser_crawlers "https://github.com/apify/actor-templates/blob/master/templates/js-crawlee-playwright-chrome/src/main.js"
click node_python_crawlers "https://github.com/apify/actor-templates/blob/master/templates/python-crawlee-playwright/my_actor/main.py"
click node_scrapy_items "https://github.com/apify/actor-templates/blob/master/templates/python-scrapy/my_actor/items.py"
click node_scrapy_pipeline "https://github.com/apify/actor-templates/blob/master/templates/python-scrapy/my_actor/pipelines.py"
click node_browser_use "https://github.com/apify/actor-templates/blob/master/templates/python-browseruse/my_actor/main.py"
click node_browser_config "https://github.com/apify/actor-templates/blob/master/templates/python-browseruse/my_actor/config.py"
click node_browser_compat "https://github.com/apify/actor-templates/blob/master/templates/python-browseruse/my_actor/compat.py"
click node_langchain "https://github.com/apify/actor-templates/blob/master/templates/js-langchain/src/main.js"
click node_vector_cache "https://github.com/apify/actor-templates/blob/master/templates/js-langchain/src/vector_index_cache.js"
click node_bee_agent "https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/main.ts"
click node_structured_output "https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/structured_response_generator.ts"
click node_calculator_tool "https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/tools/calculator.ts"
click node_instagram_tool "https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/tools/instagram.ts"
click node_python_mcp "https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/server.py"
click node_mcp_gateway "https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/mcp_gateway.py"
click node_mcp_events "https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/event_store.py"
click node_mcp_models "https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/models.py"
click node_mcp_constants "https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/const.py"
click node_ts_mcp "https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/server.ts"
click node_ts_billing "https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/billing.ts"
click node_ts_mcp_protocol "https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/mcp.ts"
click node_playwright_runner "https://github.com/apify/actor-templates/blob/master/templates/ts-playwright-test-runner/src/main.ts"
click node_playwright_transform "https://github.com/apify/actor-templates/blob/master/templates/ts-playwright-test-runner/src/transform.ts"

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_basics,node_empty,node_template_api toneBlue
class node_cheerio_crawlers,node_browser_crawlers,node_python_crawlers,node_scrapy_items,node_scrapy_pipeline toneAmber
class node_browser_use,node_browser_config,node_browser_compat,node_langchain,node_vector_cache,node_bee_agent,node_structured_output,node_calculator_tool,node_instagram_tool,node_cli toneMint
class node_python_mcp,node_mcp_gateway,node_mcp_events,node_mcp_models,node_mcp_constants,node_ts_mcp,node_ts_billing,node_ts_mcp_protocol,node_playwright_runner,node_playwright_transform toneRose
class node_developer toneIndigo
```

## Components

### Template catalog

- [Starter projects](https://github.com/apify/actor-templates/blob/master/templates/js-start/src/main.js): `templates/js-start/src/main.js`
- [Empty projects](https://github.com/apify/actor-templates/blob/master/templates/js-empty/src/main.js): `templates/js-empty/src/main.js`
- [Manifest API](https://github.com/apify/actor-templates/blob/master/src/index.js): `src/index.js`

### Scraping and browsers

- [Cheerio crawlers](https://github.com/apify/actor-templates/blob/master/templates/js-crawlee-cheerio/src/routes.js): `templates/js-crawlee-cheerio/src/routes.js`
- [Browser crawlers](https://github.com/apify/actor-templates/blob/master/templates/js-crawlee-playwright-chrome/src/main.js): `templates/js-crawlee-playwright-chrome/src/main.js`
- [Python crawlers](https://github.com/apify/actor-templates/blob/master/templates/python-crawlee-playwright/my_actor/main.py): `templates/python-crawlee-playwright/my_actor/main.py`
- [Scrapy items](https://github.com/apify/actor-templates/blob/master/templates/python-scrapy/my_actor/items.py): `templates/python-scrapy/my_actor/items.py`
- [Scrapy pipeline](https://github.com/apify/actor-templates/blob/master/templates/python-scrapy/my_actor/pipelines.py): `templates/python-scrapy/my_actor/pipelines.py`

### AI agent examples

- [Browser Use agent](https://github.com/apify/actor-templates/blob/master/templates/python-browseruse/my_actor/main.py): `templates/python-browseruse/my_actor/main.py`
- [Browser configuration](https://github.com/apify/actor-templates/blob/master/templates/python-browseruse/my_actor/config.py): `templates/python-browseruse/my_actor/config.py`
- [Signal compatibility](https://github.com/apify/actor-templates/blob/master/templates/python-browseruse/my_actor/compat.py): `templates/python-browseruse/my_actor/compat.py`
- [LangChain retrieval](https://github.com/apify/actor-templates/blob/master/templates/js-langchain/src/main.js): `templates/js-langchain/src/main.js`
- [Vector index cache](https://github.com/apify/actor-templates/blob/master/templates/js-langchain/src/vector_index_cache.js): `templates/js-langchain/src/vector_index_cache.js`
- [BeeAI agent](https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/main.ts): `templates/ts-beeai-agent/src/main.ts`
- [Structured output](https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/structured_response_generator.ts): `templates/ts-beeai-agent/src/structured_response_generator.ts`
- [Calculator tool](https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/tools/calculator.ts): `templates/ts-beeai-agent/src/tools/calculator.ts`
- [Instagram tool](https://github.com/apify/actor-templates/blob/master/templates/ts-beeai-agent/src/tools/instagram.ts): `templates/ts-beeai-agent/src/tools/instagram.ts`

### Protocols and tools

- [Python MCP proxy](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/server.py): `templates/python-mcp-proxy/my_actor/server.py`
- [MCP gateway](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/mcp_gateway.py): `templates/python-mcp-proxy/my_actor/mcp_gateway.py`
- [MCP event store](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/event_store.py): `templates/python-mcp-proxy/my_actor/event_store.py`
- [MCP models](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/models.py): `templates/python-mcp-proxy/my_actor/models.py`
- [MCP policy constants](https://github.com/apify/actor-templates/blob/master/templates/python-mcp-proxy/my_actor/const.py): `templates/python-mcp-proxy/my_actor/const.py`
- [TypeScript MCP server](https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/server.ts): `templates/ts-mcp-proxy/src/server.ts`
- [Message billing](https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/billing.ts): `templates/ts-mcp-proxy/src/billing.ts`
- [MCP protocol handlers](https://github.com/apify/actor-templates/blob/master/templates/ts-mcp-proxy/src/mcp.ts): `templates/ts-mcp-proxy/src/mcp.ts`
- [Playwright test runner](https://github.com/apify/actor-templates/blob/master/templates/ts-playwright-test-runner/src/main.ts): `templates/ts-playwright-test-runner/src/main.ts`
- [Report transformation](https://github.com/apify/actor-templates/blob/master/templates/ts-playwright-test-runner/src/transform.ts): `templates/ts-playwright-test-runner/src/transform.ts`

### Other components

- **Developer**
- **Apify CLI**

## Connections

- Developer → Apify CLI: selects template (evidence: `README.md`)
- Apify CLI → Starter projects: bootstraps project (evidence: `README.md`)
- Apify CLI → Empty projects: bootstraps project (evidence: `README.md`)
- Developer → Manifest API: fetches manifest (evidence: `README.md`)
- Scrapy pipeline → Scrapy items: processes items (evidence: `templates/python-scrapy/my_actor/pipelines.py`)
- LangChain retrieval → Vector index cache: caches index (evidence: `templates/js-langchain/src/main.js`)
- BeeAI agent → Structured output: generates output (evidence: `templates/ts-beeai-agent/src/main.ts`)
- BeeAI agent → Calculator tool: invokes tool (evidence: `templates/ts-beeai-agent/src/main.ts`)
- BeeAI agent → Instagram tool: invokes tool (evidence: `templates/ts-beeai-agent/src/main.ts`)
- Python MCP proxy → MCP gateway: routes requests (evidence: `templates/python-mcp-proxy/my_actor/server.py`)
- Python MCP proxy → MCP event store: tracks events (evidence: `templates/python-mcp-proxy/my_actor/server.py`)
- Python MCP proxy → MCP models: uses models (evidence: `templates/python-mcp-proxy/my_actor/server.py`)
- Python MCP proxy → MCP policy constants: uses constants (evidence: `templates/python-mcp-proxy/my_actor/server.py`)
- MCP gateway → MCP policy constants: filters tools (evidence: `templates/python-mcp-proxy/my_actor/mcp_gateway.py`)
- TypeScript MCP server → Message billing: charges messages (evidence: `templates/ts-mcp-proxy/src/server.ts`)
- TypeScript MCP server → MCP protocol handlers: handles protocol (evidence: `templates/ts-mcp-proxy/src/server.ts`)
- Playwright test runner → Report transformation: transforms report (evidence: `templates/ts-playwright-test-runner/src/main.ts`)
