JavaScript: Difference Between Module, Library, Package, API, SDK, Framework and Application

In this post, we will determine what these terms mean and how they relate to each other in the context of JavaScript.


An isolated code performing a specific functionality is called a module. Usually, but not necessarily, the code is contained in a single file or grouped together in a directory. For example, the below can be called add, subtract, multiply, and divide modules:


const add = (a, b) => {
    return a + b;

export {

const subtract = (a, b) => {
    return a - b;

export {
// multiply.js

const multiply = (a, b) => {
    return a * b;

export {

const divide = (a, b) => {
    return a / b;

export {

Inside the module, the implementation could contain any valid JavaScript code, including classes, functions, arrays, objects, etc.


A library is a reusable code that provides well-tested functionality through a well-defined interface. It can contain one or more modules. From the previous example, we could group add, subtract, multiply, and divide modules in the my-calculator library. A real example would be lodash.


A package is the compiled form of the library for distribution. A package mainly contains the source code, distribution code, documentation, examples, executables, test suite, meta-data (such as version number), etc.

A package manager stores all package versions in a compressed form in an online registry. For JavaScript, npm is the defacto package manager and registry.

The distinction between a library and its package could be understood by the following:

  • Lodash library.
  • The package of lodash.

Both library and package terms are used interchangeably in the JavaScript community.


API stands for Application Programming Interface. The general explanation is that when two software communicates through an interface, that interface is called API. In the context of JavaScript, it usually means one or the combination of the followings:

  • Cloud/Backend APIs of the server
  • Browser APIs
  • Operating System Level APIs

Browser APIs and OS-level APIs are specific to their runtime environments i.e., browser and Node JS, respectively.

In addition to the above, API also means the interface a JavaScript library exposes through which we can use its code and functionality. From our above example from the module, add, subtract, multiply, and divide are the APIs of the my-calculator library.


SDK means Software Development Kit. In web terms, it is a set of tools provided by a third-party vendor/service/application in major languages, including JavaScript, so that developers can build features or applications with its help. The SDK abstracts away the underlying complexity and minor details of integrating these services so that we don’t have to worry about the integration part and can focus on the feature development. In short, SDK comes with plenty of benefits:

  • Abstraction of implementation details
  • Intellisense for code editors
  • Error handling
  • Documentation
  • Helper methods
  • More control over the environment the SDK is running in (such as cookie management)

For more details, check JavaScript SDK post.

Are JavaScript Library And SDK the same thing? It’s a superset subset relationship between the two. All SDKs are libraries, but all libraries are not SDKs. To be an SDK, the library must be provided by a third-party vendor (or someone else on their behalf, like an open-source project) to facilitate the integration with the services they provide.

Real world examples of JavaScript SDKs:


A framework is a collection of libraries and configurations put together in a basic structure/skeleton that can be used to build software or application. Essentially, the framework tells you how and where to add your code about what, and then runs it for you. For example:

  • Express JS is a web framework built for Node JS. With the help of Express JS, we create web applications (mostly backend APIs).
  • Create React App, or the skeleton code it generates, can also be considered a framework, as it provides a basic structure to develop React applications. (whereas React JS is just a UI library).

Application or App

An application is a complex piece of software that a user or another software can interface with. For example, in the case of JavaScript, the apps could be backend, frontend, mobile (e.g., react native), desktop (like electron), or even embedded. It’s usually developed with a framework and contains multiple libraries along with the business logic code written specifically for the app.

See also

When you purchase through links on, I may earn an affiliate commission.