# Bluesky Analytics Suite (`frayess_mosbehi/bluesky-analytics-suite`) Actor

All-in-one Bluesky analytics Apify Actor. Track followers, analyze engagement, benchmark accounts, and export reports via the open AT Protocol — no login required.

- **URL**: https://apify.com/frayess\_mosbehi/bluesky-analytics-suite.md
- **Developed by:** [firas\_mosbehi](https://apify.com/frayess_mosbehi) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Bluesky Analytics Suite

An [Apify Actor](https://apify.com) that turns Bluesky public data into actionable analytics. Built on the open AT Protocol — no login or API key required.

### Features

- **Profile analytics** — full profile metadata, follower/following counts, posting history.
- **Post analytics** — engagement metrics (likes, reposts, replies, quotes), media detection, hashtags, mentions.
- **Engagement insights** — engagement rate, median/P90 engagement, velocity score, posts-per-day, top hashtags, top mentions, engagement distribution.
- **Follower tracking** — follower ratio, posts-per-follower, snapshot-based growth velocity across runs.
- **Competitor benchmarking** — compare multiple handles with ranked overall scores.
- **Search** — keyword/hashtag search with date, language, and min-likes filters.
- **Social graph** — export followers and following lists with profile metadata.
- **Thread extraction** — full conversation trees from any bsky.app URL.
- **Rich exports** — JSON, CSV, Excel, and HTML reports.

### Modes

| Mode | Description |
|------|-------------|
| `profile` | Fetch one or many profiles. |
| `posts` | Fetch recent posts for a handle. |
| `search` | Search posts by keyword/hashtag. |
| `followers` | Export a handle's followers. |
| `following` | Export accounts a handle follows. |
| `thread` | Extract a post thread. |
| `analytics` | Full analytics report for one or more handles. |

### Pricing

- First **100 results free** per run.
- **$0.003 per post or profile** scraped.

### Quick start

#### Run on Apify

1. Open the actor on Apify Store: https://apify.com/frayess_mosbehi/bluesky-analytics-suite
2. Choose a mode and enter handles/queries.
3. Run the actor and download JSON/CSV/Excel/HTML results.

#### Run locally

```bash
npm install --legacy-peer-deps
npm run build

## Create input file
mkdir -p storage/key_value_stores/default
cp examples/analytics.json storage/key_value_stores/default/INPUT.json

## Run
APIFY_LOCAL_STORAGE_DIR=./storage node dist/main.js
````

Results are written to `storage/datasets/default/` and analytics reports to `storage/key_value_stores/default/`:

- `REPORT.json` — full analytics report
- `REPORT.csv` — benchmark table
- `REPORT.xlsx` — Excel workbook
- `REPORT.html` — HTML report (when `outputFormat: html`)

### Examples

See the [`examples/`](./examples) directory for ready-to-use input configurations:

- `profile.json`
- `posts.json`
- `search.json`
- `followers.json`
- `thread.json`
- `analytics.json`

### Input schema

| Field | Type | Description |
|-------|------|-------------|
| `mode` | string | **Required.** One of `profile`, `posts`, `search`, `followers`, `following`, `thread`, `analytics`. |
| `handles` | string\[] | Handles/DIDs for profile, posts, followers, following, analytics modes. |
| `queries` | string\[] | Keywords/hashtags for search mode. |
| `postUrl` | string | bsky.app URL or AT URI for thread mode. |
| `maxResults` | integer | Max items per handle/query. Default `100`, max `10000`. |
| `sort` | string | Search sort: `top` or `latest`. Default `latest`. |
| `language` | string | ISO language filter for search. |
| `minLikes` | integer | Minimum likes filter. |
| `since` | string | Start date filter `YYYY-MM-DD`. |
| `until` | string | End date filter `YYYY-MM-DD`. |
| `includeReposts` | boolean | Include reposts in author feed. Default `false`. |
| `includeAnalytics` | boolean | Compute analytics report. Default `true`. |
| `outputFormat` | string | Analytics report format: `json` or `html`. Default `json`. |

### Development

```bash
npm install --legacy-peer-deps
npm run dev        # run with Apify CLI
npm run test       # run Vitest tests
npm run lint       # run ESLint
npm run format     # run Prettier
npm run build      # compile TypeScript
```

### Deploy to Apify

#### Manual deploy

```bash
npm run build
apify login
apify push
```

#### Automated deploy via GitHub Actions

1. Create an Apify API token in the [Apify Console](https://console.apify.com/account#/integrations).
2. Add it as a repository secret named `APIFY_TOKEN` in GitHub.
3. Publish a GitHub release — the actor will deploy automatically.

### Tech stack

- Node.js 20 + TypeScript
- Apify SDK + Crawlee
- Direct AT Protocol XRPC calls
- Zod for input validation
- Vitest for testing

### FAQ

**Do I need a Bluesky login or API key?**\
No. The actor reads only public data via Bluesky's public AT Protocol endpoints.

**What data can I scrape?**\
Public profiles, posts, followers, following lists, search results, and threads. Private accounts and DMs are not accessible.

**How is pricing calculated?**\
You pay **$0.003 per post or profile** returned, plus a **$0.00005** actor start fee. The first 100 results of every run are free.

**What are the rate limits?**\
The actor uses polite exponential backoff and respects Bluesky's public rate limits. Very large lists may take longer to finish.

**Can I schedule runs?**\
Yes. Use the Apify Scheduler to run the actor daily or weekly for follower tracking or mention monitoring.

### Comparison with raw Bluesky scrapers

| Capability | Raw scraper | Bluesky Analytics Suite |
|------------|-------------|-------------------------|
| Public posts & profiles | ✅ | ✅ |
| Engagement rate & velocity | ❌ | ✅ |
| Follower growth tracking | ❌ | ✅ |
| Multi-handle benchmarking | ❌ | ✅ |
| CSV / Excel / HTML reports | Rarely | ✅ |
| No login or API key | Varies | ✅ |

### Screenshots

*Store screenshots will be added here: input UI, HTML report, Excel output, and CSV output.*

### Love this actor?

If it saved you time, please leave a review on the [Apify Store](https://apify.com/frayess_mosbehi/bluesky-analytics-suite) — it helps others discover the tool and supports ongoing development.

### Support

For issues or feature requests, open an issue on [GitHub](https://github.com/firas-apify/bluesky-analytics-suite/issues) or contact the developer through Apify.

### License

MIT

# Actor input Schema

## `mode` (type: `string`):

What the actor should do.

## `handles` (type: `array`):

Bluesky handles or DIDs to analyze (without @). Used by profile, posts, followers, following, and analytics modes.

## `queries` (type: `array`):

Keywords or hashtags to search for. Used by search mode.

## `postUrl` (type: `string`):

A bsky.app post URL or AT URI. Used by thread mode.

## `maxResults` (type: `integer`):

Maximum number of posts/profiles/users to return per handle/query.

## `sort` (type: `string`):

Sort order for search mode.

## `language` (type: `string`):

ISO 639-1 language code filter for search mode (e.g. en, es, de).

## `minLikes` (type: `integer`):

Only return posts with at least this many likes.

## `since` (type: `string`):

Only return posts created on or after this date (YYYY-MM-DD).

## `until` (type: `string`):

Only return posts created on or before this date (YYYY-MM-DD).

## `includeReposts` (type: `boolean`):

Whether to include reposts in author feed output.

## `includeAnalytics` (type: `boolean`):

Compute and output analytics reports (engagement, follower tracking, benchmarks).

## `outputFormat` (type: `string`):

Format for the analytics report stored in the key-value store.

## Actor input object example

```json
{
  "mode": "analytics",
  "handles": [
    "bsky.app"
  ],
  "queries": [
    "bluesky"
  ],
  "postUrl": "",
  "maxResults": 100,
  "sort": "latest",
  "language": "",
  "minLikes": 0,
  "since": "",
  "until": "",
  "includeReposts": false,
  "includeAnalytics": true,
  "outputFormat": "json"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "analytics",
    "handles": [
        "bsky.app"
    ],
    "queries": [
        "bluesky"
    ],
    "maxResults": 100,
    "sort": "latest"
};

// Run the Actor and wait for it to finish
const run = await client.actor("frayess_mosbehi/bluesky-analytics-suite").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "analytics",
    "handles": ["bsky.app"],
    "queries": ["bluesky"],
    "maxResults": 100,
    "sort": "latest",
}

# Run the Actor and wait for it to finish
run = client.actor("frayess_mosbehi/bluesky-analytics-suite").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "analytics",
  "handles": [
    "bsky.app"
  ],
  "queries": [
    "bluesky"
  ],
  "maxResults": 100,
  "sort": "latest"
}' |
apify call frayess_mosbehi/bluesky-analytics-suite --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=frayess_mosbehi/bluesky-analytics-suite",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bluesky Analytics Suite",
        "description": "All-in-one Bluesky analytics Apify Actor. Track followers, analyze engagement, benchmark accounts, and export reports via the open AT Protocol — no login required.",
        "version": "1.0",
        "x-build-id": "eQSaxps0x8bcCgnHL"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/frayess_mosbehi~bluesky-analytics-suite/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-frayess_mosbehi-bluesky-analytics-suite",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/frayess_mosbehi~bluesky-analytics-suite/runs": {
            "post": {
                "operationId": "runs-sync-frayess_mosbehi-bluesky-analytics-suite",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/frayess_mosbehi~bluesky-analytics-suite/run-sync": {
            "post": {
                "operationId": "run-sync-frayess_mosbehi-bluesky-analytics-suite",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "profile",
                            "posts",
                            "search",
                            "followers",
                            "following",
                            "thread",
                            "analytics"
                        ],
                        "type": "string",
                        "description": "What the actor should do.",
                        "default": "analytics"
                    },
                    "handles": {
                        "title": "Handles",
                        "type": "array",
                        "description": "Bluesky handles or DIDs to analyze (without @). Used by profile, posts, followers, following, and analytics modes.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "queries": {
                        "title": "Queries",
                        "type": "array",
                        "description": "Keywords or hashtags to search for. Used by search mode.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "postUrl": {
                        "title": "Post URL",
                        "type": "string",
                        "description": "A bsky.app post URL or AT URI. Used by thread mode.",
                        "default": ""
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of posts/profiles/users to return per handle/query.",
                        "default": 100
                    },
                    "sort": {
                        "title": "Search sort",
                        "enum": [
                            "top",
                            "latest"
                        ],
                        "type": "string",
                        "description": "Sort order for search mode.",
                        "default": "latest"
                    },
                    "language": {
                        "title": "Language",
                        "type": "string",
                        "description": "ISO 639-1 language code filter for search mode (e.g. en, es, de).",
                        "default": ""
                    },
                    "minLikes": {
                        "title": "Minimum likes",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return posts with at least this many likes.",
                        "default": 0
                    },
                    "since": {
                        "title": "Since",
                        "type": "string",
                        "description": "Only return posts created on or after this date (YYYY-MM-DD).",
                        "default": ""
                    },
                    "until": {
                        "title": "Until",
                        "type": "string",
                        "description": "Only return posts created on or before this date (YYYY-MM-DD).",
                        "default": ""
                    },
                    "includeReposts": {
                        "title": "Include reposts",
                        "type": "boolean",
                        "description": "Whether to include reposts in author feed output.",
                        "default": false
                    },
                    "includeAnalytics": {
                        "title": "Include analytics",
                        "type": "boolean",
                        "description": "Compute and output analytics reports (engagement, follower tracking, benchmarks).",
                        "default": true
                    },
                    "outputFormat": {
                        "title": "Output format",
                        "enum": [
                            "json",
                            "html"
                        ],
                        "type": "string",
                        "description": "Format for the analytics report stored in the key-value store.",
                        "default": "json"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
