Skip to content

MannyFrias/Ghostbusters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ghostbusters 👻

Stop phantom endpoints from haunting your codebase.

Ghostbusters is a lightweight JavaScript utility designed to identify "ghost routes" (unused or broken endpoints) in React-to-Express routing. By integrating directly into your Git workflow, it ensures that dead code is eliminated before it ever hits production.

📇 Features

  • ESM Support: Optimized for modern environments using ECMAScript Modules to provide a lightweight and efficient footprint.
  • Git Hooks: Leverages Husky to automate code quality checks, catching ghost routes at the point of commit.
  • Dedicated CLI: Includes a dedicated entry point for terminal-based route detection.

🔍 How it Works

Ghostbusters analyzes your codebase to identify discrepancies between your frontend API calls and backend routes. It specifically flags:

  • Broken Calls: Requests in your frontend that point to routes that don't exist in your backend.

🚦 Getting Started

Prerequisites

  • Node.js
  • npm

Installation

npm install @ghostbusters/cli --save-dev

Configruation

Create a ghostbusters.config.js in your project root to customize scan directories and ignore patterns.

// ghostbusters.config.js
export default {
  frontend: ["./src/client", "./src/components"],
  backend: ["./src/server", "./src/api"],
  ignore: ["node_modules", "dist", "*.test.js"]
};

Package.json Setup

Add a script to your package.json for easy scanning.

scripts: {
  "ghostbusters": "ghostbusters scan --frontend ./src/client --backend ./src/server"
  }

🧼 Usage

# Basic scan
  npx ghostbusters

# options:
  Run without console output
  -s or --silent

# Output results as a JSON object for custom tooling
  -j, --json

🏛️ Project Structure

  • .husky/: Pre-commit hook configurations
  • src/: Core logic & CLI entry point
  • test/: Quality control test suites
  • scripts/: Development automation helpers
  • package.json: ESM configuration & dependencies

🧪 Testing

We use a dedicated test suite to ensure the detection logic is accurate.

npm test

⚖️ License

This project is licensed under the MIT License.

✍🏾 Contributors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5