Framework vs Library vs Package

March 06, 2024


Framework and Library have a distinct meaning whereas Package is generic. They all have one thing in common. They're all dependencies of a project or application.

Table of Contents



A Framework can take many forms. In all cases, they provide a guideline or scaffolding for your application to take shape.

Frameworks necessarily provide Libraries that are used in build your application. They may also provide:

  • CLI tool(s) to help the code building or other development process.
  • A documented convention of file and code structure that you must follow for your application to fit within the Framework.
    • This file and code structure may provide Inversion of Control (the Framework may implicitly search for code and call it).
  • IDE support to help your code adhere to the Framework's guidelines.


  • Django (Python)
  • Angular (JavaScript)
  • Spring (Java)


A Library is any code that can be imported into a codebase. It may or may not be vended through a package manager.

Libraries are intended to provide additional functionality which may or may not come with significant overhead. This overhead may either take the form of:

  • Physical disk space in the built artifact that is deployed to its host(s).
  • Memory space of the various other features and functionalities that are not necessary for your use case.
  • Runtime overhead from operations in the Library's control flow that are required so that the feature is modular to many use cases other than yours.

The point that is attempting to be driven here is that there is always a tradeoff that should be weighed when considering to import a new package into your application. It may make more sense to build that feature yourself from scratch.


  • NumPy (Python)
  • React (JavaScript)
  • Guava (Java)


A Package could refer to any code that is grouped together. This includes:

  • Libraries.
  • Frameworks.

Packages may or may not be distributed or vended. Some programming languages refer to their vended Libraries as packages managed by package managers. The blog post Dependency Graph briefly explores dependencies and package managers.

Some programming languages, like Java, refer to namespaces that take the shape of a file directory as packages.


It's very common for these terms to be used casually to refer to each other, especially if the Framework is very minimal, or if the Library is very robust. The TLDR:

  • Frameworks are meant to be used when you want an overarching architecture to guide the flow of your application (both flow of writing code and data flow).
  • Libraries are meant to provide additional functionality to your application.
  • Packages have a broad meaning that could refer to either of the above, or a few other specific meanings.

An interesting nuance is that React is considered to be a Library, rather than a Framework. This is despite the fact that it even offers its own flavor of JavaScript called JSX alongside a comprehensive Library. It's such a robust Library that no one will blame you for calling it a Framework. However, because it is not opinionated, and lacks any guidelines for how to structure your application, it is simply a robust Library. If you were to include additional libraries like React Router for navigation and Redux for state management, then it would begin to feel more opinionated and framework-like.