GeekflareModule with an injectable GeekflareService, typed request DTOs, and .env config via ConfigModule. The examples use the official @geekflare/api-node SDK.
Prerequisites
- NestJS 10+
- Node.js 18+
- A Geekflare API key — get one free
Installation
- pnpm
- npm
Set your API key
.env
Module setup
GeekflareService
Create a service that instantiates the client once and exposes typed methods.
src/geekflare/geekflare.service.ts
GeekflareModule
src/geekflare/geekflare.module.ts
AppModule
Register ConfigModule globally so ConfigService is available everywhere, then import GeekflareModule.
src/app.module.ts
Web Scraping
DTOs
src/scrape/dto/scrape.dto.ts
Controller
src/scrape/scrape.controller.ts
Search
DTOs
src/search/dto/search.dto.ts
Controller
src/search/search.controller.ts
Screenshot
DTOs
src/screenshot/dto/screenshot.dto.ts
Controller
src/screenshot/screenshot.controller.ts
Wiring it all together
Register your feature modules inAppModule:
src/app.module.ts
ValidationPipe globally in main.ts to activate the DTO decorators:
src/main.ts
Error handling
NestJS mapsHttpException to the correct HTTP status automatically. For a global catch-all, add an exception filter:
src/filters/geekflare-exception.filter.ts
main.ts:
Common error codes
Next steps
- Cloudflare Workers quickstart — Edge-native
fetchrequests - Python quickstart — Official Python SDK
- API Reference — Full endpoint documentation
- SDK on npm