# Introduction

> Welcome to jscpd documentation.

Welcome to **jscpd**, a powerful copy/paste detector for programming source code that supports **223+ languages and formats**.

## Two Versions

jscpd is available in two major versions:

<table>
<thead>
  <tr>
    <th>
      
    </th>
    
    <th>
      v5 (Rust)
    </th>
    
    <th>
      v4 (TypeScript)
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Install
      </strong>
    </td>
    
    <td>
      <code>
        npm install -g jscpd@5
      </code>
    </td>
    
    <td>
      <code>
        npm install -g jscpd@4
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Speed
      </strong>
    </td>
    
    <td>
      24-37x faster
    </td>
    
    <td>
      Baseline
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Runtime
      </strong>
    </td>
    
    <td>
      Self-contained binary (no Node.js)
    </td>
    
    <td>
      Requires Node.js
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        API
      </strong>
    </td>
    
    <td>
      Rust crates (<code>
        cpd-finder
      </code>
      
      , <code>
        cpd-core
      </code>
      
      )
    </td>
    
    <td>
      Node.js (<code>
        import { jscpd } from 'jscpd'
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Support
      </strong>
    </td>
    
    <td>
      Active development
    </td>
    
    <td>
      Maintenance
    </td>
  </tr>
</tbody>
</table>

Use **v5** for the fastest detection. Use **v4** if you need the Node.js programmatic API. Both can coexist — see the [Migration Guide](/getting-started/migration).

## What is jscpd?

jscpd is a tool that helps you find duplicated blocks in programming source code. Copy/paste is a common source of technical debt in software projects, and jscpd helps you identify and eliminate these duplications.

The tool uses the [Rabin-Karp rolling hash algorithm](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm) for efficient searching of duplications across large codebases. In v5, the engine is implemented in Rust; in v4, it runs on Node.js.

## What's New in v5

jscpd v5 is a **complete Rust rewrite** — a self-contained native binary that's **24-37x faster** than the TypeScript engine, with no Node.js runtime required. It also introduces **13 reporters**, **OXC-based JS/TS tokenization**, and **parallel detection** across format groups.

See the [Changelog](/getting-started/changelog) for the full release history, or the [Migration Guide](/getting-started/migration) for upgrading from v4.

## Key Features

<card-group>
<card icon="i-lucide-languages" title="223+ Languages">

Supports JavaScript, TypeScript, Python, Java, C++, Go, Rust, and many more — including cross-format detection for Vue, Svelte, Astro, and Markdown.

</card>

<card icon="i-lucide-zap" title="Blazingly Fast (v5)">

v5's Rust engine is 24-37x faster than v4. Scans massive codebases in milliseconds, not seconds.

</card>

<card icon="i-lucide-terminal" title="CLI-First + Rust API">

v5: single native binary with Rust crate API. v4: Node.js API for programmatic use. Same CLI commands in both.

</card>

<card icon="i-lucide-file-chart-column" title="13 Reporters">

Generate reports in console, console-full, HTML, JSON, XML, CSV, Markdown, SARIF, AI, badge, xcode, threshold, and silent formats.

</card>

<card icon="i-lucide-sparkles" title="AI-Ready">

Compact `ai` reporter saves ~79% tokens. MCP server for AI assistants. Agent skill for automatic refactoring.

</card>

<card icon="i-lucide-shuffle" title="Cross-Format Detection">

Vue SFC, Svelte, Astro, and Markdown files are tokenized per-block — a `<script>` in `.vue` matches `.ts` files.

</card>
</card-group>

## Packages

### v5 (Rust)

<table>
<thead>
  <tr>
    <th>
      Package
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        jscpd
      </strong>
    </td>
    
    <td>
      Main binary — <code>
        npm install -g jscpd@5
      </code>
      
       or <code>
        cargo install jscpd
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        cpd
      </strong>
    </td>
    
    <td>
      Lightweight alias — same binary, shorter command
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        jscpd-server
      </strong>
    </td>
    
    <td>
      Standalone server (REST API + MCP) — still Node.js based
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        cpd-core
      </strong>
    </td>
    
    <td>
      Rust crate — core detection algorithm
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        cpd-tokenizer
      </strong>
    </td>
    
    <td>
      Rust crate — source code tokenizer
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        cpd-finder
      </strong>
    </td>
    
    <td>
      Rust crate — file walking, orchestration, git blame
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        cpd-reporter
      </strong>
    </td>
    
    <td>
      Rust crate — 13 output reporters
    </td>
  </tr>
</tbody>
</table>

### v4 (TypeScript) — Maintenance

<table>
<thead>
  <tr>
    <th>
      Package
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        jscpd@4
      </strong>
    </td>
    
    <td>
      CLI + Node.js API (<code>
        import { jscpd } from 'jscpd'
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        jscpd-server
      </strong>
    </td>
    
    <td>
      Standalone server (REST API + MCP)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/core
      </strong>
    </td>
    
    <td>
      Core detection algorithm
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/finder
      </strong>
    </td>
    
    <td>
      File duplication detector
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/tokenizer
      </strong>
    </td>
    
    <td>
      Source code tokenizer
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/html-reporter
      </strong>
    </td>
    
    <td>
      HTML report generator
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/badge-reporter
      </strong>
    </td>
    
    <td>
      Badge generator
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/sarif-reporter
      </strong>
    </td>
    
    <td>
      SARIF reporter
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        @jscpd/leveldb-store
      </strong>
    </td>
    
    <td>
      LevelDB store for big codebases
    </td>
  </tr>
</tbody>
</table>

## Quick Example

```bash
# v5 — install Rust binary (recommended)
npm install -g jscpd@5

# v5 — or via cargo
cargo install jscpd

# v4 — install TypeScript version
npm install -g jscpd@4

# Both versions use the same CLI
jscpd /path/to/source
```

Ready to get started? Head to the [Installation](/getting-started/installation) guide or the [Migration Guide](/getting-started/migration) if you're upgrading from v4.
