A web framework is a library of ready-made structure for building web applications: routing, templates or components, forms, database access, authentication. It gives a team a shared way of working in exchange for following its conventions. Frameworks exist for servers and for browsers, and they come and go, so learn the ideas beneath them.
Key concepts
- Routing: mapping a URL and method to the code that handles it.
- Templates and components: turning data into HTML on the server, in the browser, or in both.
- Convention over configuration: sensible defaults let you skip decisions, until you need to override them.
- Middleware and lifecycle: hooks around each request or each rendered component.
- Inversion of control: the framework calls your code, instead of your code calling a library.
Vocabulary
- MVC: model, view, controller, a common way to divide an application.
- Server-side rendering: producing the HTML on the server before it reaches the browser.
- Scaffolding: generating the starting files of a project or feature.
- Micro-framework: a small framework that gives routing and little else.
What to study, in order
- Write a tiny framework yourself: a router, a template function and a request handler.
- Build one real app with a server-side framework in a language you know.
- Build the same app with a browser-side component framework and compare the effort.
- Read the framework's own documentation on its request lifecycle and its security defaults.
- Upgrade the app across a major change and see what coupling to the framework costs.