Skip to content

Repository files navigation

⚑ SparkFetch

Turn any URL into clean, structured, LLM-ready content.

The open-source web fetching & content extraction API.

Website Stars License CI TypeScript Node.js


What is SparkFetch?

SparkFetch is a powerful, self-hostable API that crawls and extracts web content β€” converting messy HTML into clean Markdown, structured JSON, or plain text. Built for AI applications, RAG pipelines, research tools, and any workflow that needs reliable web data.

Key capabilities:

  • 🌐 Scrape β€” Fetch any URL and get clean Markdown + metadata
  • πŸ•·οΈ Crawl β€” Recursively crawl entire websites with depth control
  • πŸ—ΊοΈ Map β€” Discover all URLs on a domain instantly
  • 🧹 Clean output β€” Strip nav, ads, and boilerplate automatically
  • πŸ“¦ Structured data β€” Returns JSON with title, description, links, and content
  • ⚑ Fast β€” Built on Node.js 24 + Express 5

Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 9+

Installation

# Clone the repository
git clone https://github.com/Sparkfetch/sparkfetch.git
cd sparkfetch

# Install dependencies
pnpm install

# Start the development server
pnpm --filter @workspace/api-server run dev

The API will be available at http://localhost:5000/api.


API Reference

POST /api/v1/scrape

Fetch a single URL and return its content as Markdown with metadata.

Request:

{
  "url": "https://example.com",
  "formats": ["markdown", "html"],
  "includeTags": ["article", "main"],
  "excludeTags": ["nav", "footer", "aside"]
}

Response:

{
  "success": true,
  "data": {
    "markdown": "# Page Title\n\nContent here...",
    "metadata": {
      "title": "Page Title",
      "description": "Page description",
      "url": "https://example.com",
      "statusCode": 200,
      "fetchedAt": "2025-01-01T00:00:00Z"
    }
  }
}

POST /api/v1/crawl

Crawl a website recursively and extract content from all pages.

Request:

{
  "url": "https://example.com",
  "maxDepth": 2,
  "limit": 10,
  "excludePaths": ["/login", "/admin"]
}

Response:

{
  "success": true,
  "jobId": "crawl_abc123",
  "status": "queued",
  "message": "Crawl job started. Use GET /api/v1/crawl/:jobId to check status."
}

GET /api/v1/crawl/:jobId

Check the status of a crawl job.

Response:

{
  "success": true,
  "status": "completed",
  "completed": 8,
  "total": 8,
  "data": [
    {
      "url": "https://example.com",
      "markdown": "# Home\n\n...",
      "metadata": { "title": "Home", "statusCode": 200 }
    }
  ]
}

POST /api/v1/map

Discover all accessible URLs on a domain.

Request:

{
  "url": "https://example.com",
  "limit": 100
}

Response:

{
  "success": true,
  "links": [
    "https://example.com/",
    "https://example.com/about",
    "https://example.com/blog"
  ]
}

GET /api/healthz

Health check endpoint.


Use Cases

Use Case How SparkFetch Helps
AI / RAG pipelines Feed clean Markdown into your LLM context
Research automation Batch-crawl sources and extract structured info
Content monitoring Track page changes with periodic scraping
Data collection Turn any website into structured JSON datasets
Documentation indexing Crawl and index docs sites for search

Project Structure

sparkfetch/
β”œβ”€β”€ artifacts/
β”‚   └── api-server/         # Express API (TypeScript)
β”‚       └── src/
β”‚           β”œβ”€β”€ routes/
β”‚           β”‚   └── v1/     # Versioned API routes
β”‚           └── lib/        # Utilities (fetcher, extractor, markdown)
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api-spec/           # OpenAPI 3.1 spec + codegen
β”‚   β”œβ”€β”€ api-zod/            # Zod validation schemas (generated)
β”‚   └── db/                 # Drizzle ORM schema
└── .github/
    └── workflows/
        └── ci.yml          # GitHub Actions CI

Self-Hosting

# Production build
pnpm --filter @workspace/api-server run build

# Set environment variables
export DATABASE_URL="postgresql://..."
export PORT=5000

# Start
pnpm --filter @workspace/api-server run start

Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

License

MIT Β© SparkFetch


Built with ⚑ by SparkFetch

About

πŸ”₯ Turn any URL into clean, structured, LLM-ready content. The open-source web fetching & extraction API.

Topics

Resources

Contributing

Stars

35 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages