A web framework is a software library that enables developers to write software that runs on the web. Common areas where developers use web frameworks are:
- Backend: The software that runs on servers and serves web sites, web apps, and also APIs for the exchange of data.
- Frontend: The software that runs on clients, in web browsers and provides content and interactivity to the user.
Web frameworks may be written in different languages and using different methodologies. The term 'stack' is applied to refer to the collection of different languages, software, and frameworks in use behind a specific service.
What are the uses of a backend web framework?
- Backend frameworks remove the overhead of developing a web application by abstracting repetitive tasks and providing code reusability.
- The framework generally handles routine tasks such as accepting HTTP requests, delegating processing to the appropriate handler, and formatting and returning responses.
- Frameworks can also provide database access via an ORM that maps database tables and rows to classes and instances in the application's language.
- Most frameworks also provide templating functionality for rendering the responses as HTML pages, with CSS styling and JS interactivity.
Some frameworks focus on a smaller subset of these features but still support plugins or tools to accomplish the other aspects. Popular backend frameworks are Django for Python and Ruby on Rails for Ruby.
What are the uses of a frontend web framework?
- With the advent of web applications, most notably single-page applications, frontend frameworks currently enjoy increased popularity.
- The framework can handle complex or verbose tasks such as updating the DOM in reaction to data changes, compartmentalization, state management, and routing.
- Frameworks can get data from backend APIs, meaning the backend can be independent of how the data is consumed and by whom.
- New frontend frameworks contain bespoke tooling to provide many advanced features such as novel syntax (React JSX) and file types (Vue SFC).