# Apify Market Intelligence (`devbybriyan/apify-market-intelligence`) Actor

Your BI analyst for the Apify Store. 📈 Scrapes data to reveal trending niches and competitor velocity. 🔥 UNIQUE: Generates a stunning, interactive React Dashboard report (SPA) directly in the output. Stop guessing—see what's winning instantly.

- **URL**: https://apify.com/devbybriyan/apify-market-intelligence.md
- **Developed by:** [Briyan Hingrajiya](https://apify.com/devbybriyan) (community)
- **Categories:** E-commerce, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.10 / actor start

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Apify Market Intelligence

A powerful Apify Actor that scrapes the Apify Store to find **Hot Niches** and **Trending Actors**, then generates an interactive Market Intelligence Dashboard.

### 🎯 What It Does

1. **Scrapes** the Apify Store to collect actor data (runs, stars, publication date, categories)
2. **Analyzes** trends to identify top movers, competitive niches, and blue ocean opportunities
3. **Generates** a beautiful, self-contained HTML dashboard that you can view and share

### 🚀 Quick Start

#### Install Dependencies

```bash
npm install
```

#### Build the Project

```bash
## Build dashboard (creates single HTML file)
npm run build:dashboard

## Build crawler (compiles TypeScript)
npm run build:crawler

## Build everything
npm run build
```

#### Run Locally

```bash
## Development mode (using tsx)
npm run start:dev

## Production mode (after build)
npm start
```

#### Preview Dashboard

```bash
npm run dev:dashboard
```

Then open http://localhost:5173 to see the dashboard with demo data.

### 📊 Dashboard Features

- **KPI Cards**: Top Mover, Most Competitive Niche, Blue Ocean Opportunity
- **Bar Chart**: Top 10 actors by total runs with growth indicators
- **Scatter Plot**: Actor age vs. performance to spot viral launches
- **Data Table**: Sortable, searchable list of all scraped actors

### 🏗️ Architecture

```
Input → CheerioCrawler → Data Analysis → JSON → HTML Injection → Key-Value Store
```

The "Zero Hosting" trick:

1. Actor runs the crawler
2. Saves data to a JSON object
3. Loads pre-built React dashboard template
4. Injects JSON data into `<script id="report-data">`
5. Saves the final HTML to Apify Key-Value Store
6. Returns the public URL

### 📁 Project Structure

```
├── src/
│   ├── main.ts              # Actor entry point & crawler
│   ├── types.ts             # TypeScript interfaces
│   ├── analytics.ts         # Data analysis functions
│   ├── report-generator.ts  # HTML injection & output
│   └── dashboard/           # React dashboard
│       ├── App.tsx
│       └── components/
├── .actor/                  # Apify configuration
├── Dockerfile               # Multi-stage build
└── vite.config.ts           # Single-file HTML build
```

### 🔧 Configuration

The Actor accepts the following input:

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `maxActors` | number | 100 | Maximum actors to scrape (0 = unlimited) |
| `includeCategories` | string\[] | \[] | Filter by categories |
| `generateMockHistory` | boolean | true | Generate demo growth data |

### 📄 License

MIT

# Actor input Schema

## `maxActors` (type: `integer`):

Analysis scope: Top 100 for quick insights, Top 500 for comprehensive analysis, or 0 for full market scan.

## `includeCategories` (type: `array`):

Focus your analysis on specific markets (e.g., 'Real Estate', 'Social Media', 'AI & ML'). Leave empty for full market overview.

## `sortLogic` (type: `string`):

How to rank and prioritize actors in your intelligence report.

## `generateMockHistory` (type: `boolean`):

Generate simulated historical data for visualization demo. Disable for production runs with real velocity tracking.

## Actor input object example

```json
{
  "maxActors": 100,
  "includeCategories": [],
  "sortLogic": "mostViral",
  "generateMockHistory": true
}
```

# 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 = {
    "maxActors": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("devbybriyan/apify-market-intelligence").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 = { "maxActors": 100 }

# Run the Actor and wait for it to finish
run = client.actor("devbybriyan/apify-market-intelligence").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "maxActors": 100
}' |
apify call devbybriyan/apify-market-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devbybriyan/apify-market-intelligence"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/nGFwKOW3ef7mY9Bmo/builds/ffhOjgC63yUkmH8pa/openapi.json
