Exploring the Most Commonly Used Folder Names in Popular NPM Packages

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • axios

    Promise based HTTP client for the browser and node.js

  • .github: With more than 60 occurrence, it's not surprising to see this folder on the top spot given that all of the analyzed packages are hosted on GitHub. .github is a special folder that can contain a variety of config files and templates related to GitHub Actions workflows, as well as other organizational files for a GitHub repository such as CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md and more. Example from axios.

  • node-jsonwebtoken

    JsonWebToken implementation for node.js http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html

  • tests/test/__tests__: Writing tests is an important practice in software development, and in NPM packages you'll often see them stored in one of these folders. It can also be used to hold testing helpers and utility functions. Example from express.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • node-fetch

    A light-weight module that brings the Fetch API to Node.js

  • docs: Documentation is an essential part of any package, as it provides users with the information they need to understand how to use it and how it works. The documentation usually includes usage instructions, API documentation, and more. It can also be included directly in the repository's README.md file, but it's often split into multiple files and stored in this folder for ease of navigation and maintenance. Although the documentation files can be in any format, the most common one is Markdown. Example from node-fetch.

  • Passport

    Simple, unobtrusive authentication for Node.js.

  • lib: The lib folder, short for "library", is mostly used to store the actual source code of the package, but it can also be used to store third-party code, utilities and helpers. Example from passport.

  • Express

    Fast, unopinionated, minimalist web framework for node.

  • examples: Good documentation goes well with good examples, not only does it provide a practical demonstration on how to use the package, but it also allows developers to quickly get up to speed and start using the package in their own projects. Example from express.

  • yaml

    YAML parser and stringifier for JavaScript (by eemeli)

  • src: Similar to lib, the src folder is also used to organize code, allowing for easy access to the main codebase. Example from yaml.

  • history

    Manage session history with JavaScript

  • scripts: Maintaining a package can be a lot of work, there's lots of repetitive tasks that need to be done often such as building the package for different targets, preparing a new release, etc. This is where automation scripts can help, and if a package has any, there's a good chance you'll find them in this folder. Example from history.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • React

    The library for web and native user interfaces.

  • packages: If you see a directory with this name, you're most likely looking at a monolithic repository (monorepo). Monorepos contain the code for different projects/sub-components within a single repository, this offers several benefits such as simplified dependency management, and improved code reusability to name a few. Example from react.

  • nanoid

    A tiny (124 bytes), secure, URL-friendly, unique string ID generator for JavaScript

  • bin: Sometimes it may be desired or even crucial for a package to provide a command line interface, take a testing framework like jest as an example. NPM allows packages to publish executable binaries for this purpose, and as a convention they're usually placed in this directory. Example from nanoid.

  • graphql-js

    A reference implementation of GraphQL for JavaScript

  • benchmarks: This directory contains benchmark tests that help measure the performance of the package's code, these tests can be are very useful when experimenting with performance optimizations, and to ensure no slowdowns are introduced between releases. Example from graphql.

  • husky

    Git hooks made easy 🐶 woof!

  • .husky: Git hooks are custom scripts that run in response to some event (e.g. before a commit is created), and they can choose to abort that event under certain conditions. One of their main drawbacks though is that they live inside the .git folder, which means they cannot be directly versioned like the rest of the project. This folder is used by the popular Husky package that makes it possible to include Git hooks with your project and it takes care of installing them to their appropriate location so they can be detected by Git. Example from uuid.

  • uuid

    Generate RFC-compliant UUIDs in JavaScript

  • .husky: Git hooks are custom scripts that run in response to some event (e.g. before a commit is created), and they can choose to abort that event under certain conditions. One of their main drawbacks though is that they live inside the .git folder, which means they cannot be directly versioned like the rest of the project. This folder is used by the popular Husky package that makes it possible to include Git hooks with your project and it takes care of installing them to their appropriate location so they can be detected by Git. Example from uuid.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts