spidra-nextjs) brings Spidra’s web intelligence platform natively to Next.js (App Router, Pages Router, and Server Actions). It provides cached client accessors for React Server Components (getSpidraClient()), type-safe wrappers for Server Actions (createSpidraAction()), pre-built Route Handlers for /api/spidra/*, and HMAC-SHA256 webhook handlers.
Installation
Get your API key from app.spidra.io under API Keys.
Store it in
.env.local. Never commit API keys to version control.Configuration
Configure credentials in.env.local:
getSpidraClient() automatically reads SPIDRA_API_KEY and optional overrides from your environment.
Integration patterns
1. React Server Components (RSC)
Call Spidra directly inside async Server Components without client-side waterfalls:2. Server Actions
UsecreateSpidraAction() to expose type-safe scraping functions callable directly from Client Components:
3. Pre-built Route Handlers
Mount complete Spidra REST API endpoints under/api/spidra/[...action] in one line:
POST /api/spidra/scrapeGET/POST /api/spidra/searchPOST /api/spidra/crawlPOST /api/spidra/batchPOST /api/spidra/mapPOST /api/spidra/parseGET /api/spidra/accountGET /api/spidra/usage
4. HMAC Webhooks
Verify incoming webhook deliveries (crawl.page, crawl.completed, batch.completed) with createSpidraWebhookHandler():
X-Spidra-Signature header against process.env.SPIDRA_WEBHOOK_SECRET in constant time.
Scraping & browser actions
Run browser automation steps (typing, clicking, scrolling, waiting) before extraction:Deep site crawling
Recursively crawl domains with path filtering:Live SERP & web search
Search the web and extract results across multiple sources:Batch scraping & streaming watchers
Submit up to 50 URLs concurrently and stream items as they finish:Domain mapping
Document parsing (PDF, Word, Excel)
Ready-made templates & monitors
Error handling
Node.js SDK
Core Node.js / TypeScript SDK documentation and API reference.
Express
Express.js middleware, turnkey router, and error handling.

