apify-sdk-patterns

Featured

Production-ready patterns for Apify SDK and apify-client in TypeScript. Use when building Actors with Crawlee, managing datasets/KV stores, or implementing robust client wrappers with retry and validation. Trigger: "apify SDK patterns", "apify best practices", "apify client wrapper", "crawlee patterns", "idiomatic apify".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Apify SDK Patterns ## Overview Production patterns for both the `apify` SDK (building Actors) and `apify-client` (calling Actors remotely). Covers Crawlee crawler selection, data storage, proxy configuration, and typed client wrappers. ## Prerequisites - `apify-client` and/or `apify` + `crawlee` installed - `APIFY_TOKEN` configured - TypeScript recommended ## Pattern 1: Typed Client Singleton ```typescript // src/apify/client.ts import { ApifyClient } from 'apify-client'; let instance: ApifyClient | null = null; export function getApifyClient(): ApifyClient { if (!instance) { const token = process.env.APIFY_TOKEN; if (!token) throw new Error('APIFY_TOKEN is required'); instance = new ApifyClient({ token }); } return instance; } // Reset for testing export function resetClient(): void { instance = null; } ``` ## Pattern 2: Crawlee Crawler Selection Choose the right crawler for the job: ```typescript import { CheerioCrawler, PlaywrightCrawler, PuppeteerCrawler } from 'crawlee'; // CHEERIO — Fast, lightweight, no JavaScript rendering // Use for: static HTML, server-rendered pages, APIs const cheerioCrawler = new CheerioCrawler({ async requestHandler({ request, $, enqueueLinks }) { const title = $('title').text(); await Actor.pushData({ url: request.url, title }); await enqueueLinks({ strategy: 'same-domain' }); }, }); // PLAYWRIGHT — Full browser, all engines, modern API // Use for: SPAs, JavaScript-heavy pages, complex interac...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

firecrawl-sdk-patterns

Apply production-ready Firecrawl SDK patterns for TypeScript and Python. Use when implementing Firecrawl integrations, building reusable scraping services, or establishing team coding standards for Firecrawl. Trigger with phrases like "firecrawl SDK patterns", "firecrawl best practices", "firecrawl code patterns", "idiomatic firecrawl", "firecrawl wrapper".

2,266 Updated today
jeremylongshore
AI & Automation Featured

apify-reference-architecture

Production-grade architecture patterns for Apify-powered applications. Use when designing scraping infrastructure, building multi-Actor pipelines, or integrating Apify into a larger system architecture. Trigger: "apify architecture", "apify best practices", "apify project structure", "scraping architecture", "apify system design".

2,266 Updated today
jeremylongshore
AI & Automation Featured

klaviyo-sdk-patterns

Apply production-ready Klaviyo SDK patterns for the klaviyo-api package. Use when implementing Klaviyo integrations, refactoring SDK usage, or establishing team coding standards for Klaviyo API calls. Trigger with phrases like "klaviyo SDK patterns", "klaviyo best practices", "klaviyo code patterns", "idiomatic klaviyo", "klaviyo wrapper".

2,266 Updated today
jeremylongshore
AI & Automation Featured

apollo-sdk-patterns

Apply production-ready Apollo.io SDK patterns. Use when implementing Apollo integrations, refactoring API usage, or establishing team coding standards. Trigger with phrases like "apollo sdk patterns", "apollo best practices", "apollo code patterns", "idiomatic apollo", "apollo client wrapper".

2,266 Updated today
jeremylongshore
AI & Automation Featured

castai-sdk-patterns

Production-ready CAST AI REST API wrapper patterns in TypeScript and Python. Use when building reusable CAST AI clients, implementing retry logic, or wrapping the CAST AI API for team use. Trigger with phrases like "cast ai API patterns", "cast ai client wrapper", "cast ai TypeScript", "cast ai Python client".

2,266 Updated today
jeremylongshore