How to evaluate an open-source dependency before you adopt it
Look past stars and downloads: read the code, check maintenance, licence, security, API stability and exit cost before adding a library to your project.
Adding a dependency is easy; removing one is not. A library becomes part of your product: its bugs are your bugs, its security issues are your security issues, and its abandonment is your migration. A little evaluation up front pays off.
Start with fit
- Does it solve your actual problem, or a similar one?
- Could you write the part you need in an afternoon? Small utilities often aren't worth a dependency.
- Is it designed for your environment: Node or browser, ESM or CommonJS, the framework version you use?
Check maintenance
- Recent activity: commits, releases and maintainer replies in the last few months.
- Issue health: are bugs acknowledged and fixed, or piling up?
- Bus factor: one maintainer or several? A single maintainer isn't disqualifying, but it's a risk to note.
- Release practice: a changelog, semantic versioning, migration guides for breaking changes.
Read the code
Stars and downloads say a library is popular, not that it's right for you. Spend twenty minutes in the source:
- The main entry. Follow the
exportsfield inpackage.jsonto see the public API. - The core path for your use case. Trace what happens when you call the function you'd use most.
- Error handling. Does it throw useful errors, swallow them, or crash?
- Tests. Are the cases you care about covered?
A question-and-answer tool helps here: ask RepoGrasp "what happens when fetchWithRetry gets a 429 response, and how is the delay calculated?" on the library's repository, and get an answer with citations before you install anything.
Check the dependency's own dependencies
Run npm view <package> dependencies or look at its package.json. A small library that pulls in fifty transitive dependencies brings fifty more risks. Check bundle size for front-end libraries.
Licence
Confirm the licence is compatible with how you'll ship your product. MIT, Apache 2.0 and BSD licences are permissive; copyleft licences such as GPL or AGPL carry obligations that matter for some products. Check your organisation's policy.
Security
- Search its security advisories and issues for past vulnerabilities and how fast they were fixed.
- Check whether it runs install scripts (
preinstall,postinstall). - See auditing an npm package before installing it.
API stability and exit cost
How often does the API break? How deeply would your code depend on it? Wrapping a dependency behind your own small module limits the damage if you need to replace it.
A simple scorecard
| Question | Answer |
|---|---|
| Solves our exact problem? | |
| Active in the last 3 months? | |
| More than one maintainer? | |
| Code path for our use case read? | |
| Licence approved? | |
| Transitive dependencies acceptable? | |
| Install scripts reviewed? | |
| Easy to replace if needed? |
Read a library's code with RepoGrasp before adding it.