# Framework

URL: https://softwaredictionary.org/terms/framework
Category: Programming Fundamentals
Last updated: 2026-09-29
In Turkish: çatı

In short: A framework is a reusable foundation of code, tools, and conventions that provides the structure of an application, so developers only fill in their own logic.

## What is a framework?

A framework gives you a ready-made skeleton for building a certain kind of software, such as a web app, a mobile app, or an API. It handles common, repetitive work like routing requests, rendering pages, or talking to a database, and it defines where your own code should go. This lets teams focus on the features that make their product unique.

The key idea behind a framework is inversion of control. With a library, your code is in charge and calls the library when it needs something. With a framework, the framework is in charge: it runs the application and calls your code at specific points, such as when a page loads or a request arrives.

Building a house is a helpful analogy for the difference. A library is like a hardware store where you pick the tools you need, while a framework is like a pre-built frame of walls and a roof that you finish and decorate. Well-known examples include Django, Ruby on Rails, and Spring for server-side development, and Angular and Next.js for building web applications.

Frameworks speed up development and encourage a consistent structure, but they come with trade-offs. You have to learn their conventions, follow their way of doing things, and keep up with version upgrades. Some tools blur the line: React describes itself as a library, yet many developers loosely call it a framework.

## Key takeaways

- A framework provides the structure of an application; you fill in the details.
- Inversion of control: the framework calls your code, not the other way around.
- It handles common tasks like routing, rendering, and data access.
- Trade-offs include a learning curve and less freedom to do things your own way.

## Example: Inversion of control in a web framework (Express)

```javascript
// You register handlers; the framework decides when to call them
import express from "express";

const app = express();

// Called by the framework whenever a GET /hello request arrives
app.get("/hello", (req, res) => {
  res.json({ message: "Hello, world!" }); // your own logic
});

app.listen(3000); // the framework now runs the server
```

## Frequently asked questions

**What is the difference between a framework and a library?**

With a library, your code decides when to call it. With a framework, the framework controls the flow and calls your code at defined points, which is known as inversion of control.

**Is React a framework or a library?**

React describes itself as a library for building user interfaces, because it focuses on rendering components and leaves concerns like routing and data fetching to other tools. Frameworks such as Next.js build on React to provide a complete application structure.

**Do I need a framework to build a website?**

No. You can build a website with plain HTML, CSS, and JavaScript. Frameworks become valuable as a project grows, because they provide structure and solve common problems for you.

---

Software Dictionary: https://softwaredictionary.org/ · https://softwaredictionary.org/llms.txt
