npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

codesalmon

v1.0.1

Published

cli tool to scan repos for contract drift

Readme

Salmon... Code Salmon

A Typescript backend senior dev's most trusted gadget against the dastardly silent assassins known only as Rest API Contract Drift!
Code Salmon is a CLI tool that scans TypeScript projects for REST API calls.
Once identified and targetted, the calls are made to create a baseline json file for future comparisons.
This will act as your bullet proof vest against vigilant assassin's attacks on your project.
After some time has passed:

  • Scan your project's Rest API calls again
  • Compare the response results with your comparison data
  • Make changes to your code to reflect the changing state of your API Calls

With Code Salmon, silent assassins like Rest API Contract Drift are no longer a threat and your codebase is not longer a victim.

Problem Solved

Modern TypeScript projects often rely on external APIs. These APIs can change unexpectedly, causing "silent" issues in client applications.
Code Salmon takes the guess work out by:

  • Detecting API contract drift early
  • Keeping track of all API dependencies and endpoints

What does it do?

  • Scans .ts source files for fetch() calls.
  • Extracts API URLs and associated environment variables.
  • Fetches and saves API responses as baseline in JSON file on local machine.
  • Compares future API responses against saved baselines.
  • Reports differences (contract drift) in response structures in the terminal.

Configuration Tips

  • Ensure your .env file is present in the root of the scanned project. It should contain all relevant API keys used via process.env.KEY_NAME.
  • You can customize which files are included by modifying your tsconfig.json or structure. Currently, the tool scans all .ts files unless configured otherwise.

Installation/ Set-up

Install CodeSalmon globally using npm:

 npm install codesalmon

Establish baseline for comparison:

scanSalmon

This baseline will be saved to a file in the user's local repository called:
.apiRestContracts.json

To run the drift detection script:

swimSalmon

Pro Tip:
In order to produce accurate contract drift detection results, the user must wait (days, weeks, months) in between running scanSalmon and swimSalmon.
The tool needs time to see if changes to Rest API's have been made.

Contract Drift Report

CodeSalmon generates contract drift report each time the user runs swimSalmon in the terminal.

This detailed report identifies the type of drift, the value of drift, and where it was detected.

Possible Drift Report Outputs

Changed at

  • Displays which key/value pair has changed from and to.

Addition at

  • Gives the user a warning when an additional key/value pair is added to their response object.

Removed at

  • Shows the user where a key/value pair may have experienced a removal.

Unhandled Change Type

  • Will flag the user if the response object is reconfigured or an unexpected change in type to an array.

If drift is detected:

Figure 1: Contract drift report generated by CodeSalmon
Drift

If NO drift is detected:

Figure 2: Contract drift report with no drift generated by CodeSalmon
Alt Text

Final Notes

Code Salmon identifies contract drift in Rest API Calls, it does NOT correct those changes.
It is up to Developers to use this information how they choose.

Contact