Skip to content
Happy Programming Guide
Start learning
Web Development

Introduction to Web Frameworks

What a web framework does for you, the difference between back-end and front-end frameworks, and how to choose one — or decide you do not need one.

Shelves of books in a library

A web framework is a set of solved problems. Routing, request parsing, templating, database access, sessions, security headers — every web application needs these, and a framework provides them so you write the parts that are specific to your project. This guide explains what they actually do, how back-end and front-end frameworks differ, and how to choose.

What a framework does#

Every web application has to answer the same questions. A framework answers them for you:

Problem What the framework provides
Which code handles this URL? routing
What did the visitor send? request parsing and validation
How do I produce HTML? a template engine that escapes by default
How do I talk to the database? a query builder or an ORM
Who is this person? sessions and authentication
How do I stop common attacks? CSRF tokens, escaping, secure cookies
How do I change the schema safely? migrations

You could write all of that yourself. People did, and the results were inconsistent — particularly the security parts, which are easy to get subtly wrong and hard to test.

Back end and front end#

The two kinds of framework solve different problems and are often used together.

Back-end frameworks run on your server. They receive requests, talk to the database, and return HTML or JSON. Your code is never visible to the visitor.

Front-end frameworks run in the visitor’s browser. They keep what is on screen in sync with data as it changes. Everything they do is visible and modifiable by the visitor.

Output
Browser                          Server
-------                          ------
React / Vue / Svelte    <--->    Django / Laravel / Spring / Express
renders the interface            owns the data and the rules

The security consequence matters: any check in the front end is a convenience, and must be repeated on the server.

Back-end options#

Language Framework Character
Python Django everything included, admin panel, opinionated
Python Flask, FastAPI minimal; FastAPI is built for APIs
PHP Laravel everything included, excellent documentation
PHP Symfony component-based, common in larger systems
JavaScript Express minimal, enormous ecosystem
Java Spring Boot the default in enterprise Java
C# ASP.NET Core fast, well integrated with .NET
Ruby Rails convention over configuration, very productive
Go the standard library, Gin minimal by design

The real split is between batteries-included frameworks such as Django, Laravel and Rails, which give you an ORM, authentication, an admin interface and migrations out of the box, and minimal ones such as Flask and Express, where you choose each piece yourself.

Batteries-included is usually the better choice for a first project. There are fewer decisions, and the decisions that were made for you are generally good ones.

Front-end options#

Framework Strengths Trade-offs
React largest ecosystem and job market you assemble routing and state yourself
Vue gentle learning curve, official router and store smaller job market
Svelte compiles away, least code to write smallest ecosystem
Angular everything included, strong conventions steepest start, TypeScript assumed

All four share the same three ideas — components, state and props — so moving between them is mostly a matter of syntax.

Meta-frameworks#

A front-end framework on its own leaves the page empty until JavaScript runs, which is poor for search visibility and for the first paint. Meta-frameworks add server rendering and the pieces around it:

Built on Meta-framework
React Next.js, Remix
Vue Nuxt
Svelte SvelteKit
Any or none Astro

These handle routing, data loading, server rendering and building, so you get one framework instead of five libraries. For a new project that needs both interactivity and search visibility, they are usually the right starting point.

How to choose#

Four questions, in order of how much they should weigh:

  1. What language do you already know? Learning a framework is much easier than learning a framework and a language together.
  2. What is the project? A content site, an internal tool and a real-time application have genuinely different needs.
  3. Who will maintain it? A framework nobody else on the team knows is a cost you pay every month.
  4. Is it actively maintained? Check the last release and whether issues get answers.

When you do not need one#

Frameworks add dependencies, a build step, and something the next person has to learn. Skip one when:

  • The site is static content — a blog, documentation, a brochure site. A static site generator is lighter and faster.
  • There are only a few interactive pieces. Plain JavaScript handles a form validation and a dropdown perfectly well.
  • You are learning. Building a small site without a framework once teaches you what the framework is doing, which makes the framework much easier to learn afterwards.

A useful test for a front-end framework: count the places you would have to update by hand when one value changes. One or two, and a framework is overhead. Five or more, and it is earning its place.

What to learn first#

Before any framework, be comfortable with the layer underneath it:

  • HTTP — methods, status codes, headers, what a request and response actually contain
  • HTML and CSS — frameworks generate these; you still need to read them
  • Your language — particularly arrays, objects and functions
  • SQL — an ORM hides it until something is slow, and then you need it

Most framework frustration is not framework frustration. It is a gap in one of these showing through.

Questions people ask#

Which framework should I learn first?

The one that matches a language you already know. If you know Python, Django or Flask. PHP, Laravel. JavaScript, Express or Next.js. Do not learn a new language for a framework unless you have a specific reason.

Do I need both a back-end and a front-end framework?

No. A back-end framework rendering HTML is a complete, perfectly modern architecture and is simpler to build and deploy. Add a front-end framework when the interface genuinely needs it.

What is the difference between a library and a framework?

You call a library; a framework calls you. You decide when to use a date library. A framework owns the structure of your application and invokes your code at the points it defines.

Are frameworks bad for performance?

They add some overhead, and it is almost never the bottleneck. Database queries and network round trips dominate. Measure before assuming the framework is at fault.

Where to go next#

Web development for beginners, from the ground upRead next

Keep reading

Keep going — pick your next guide

The fastest way to improve is to read one guide, then build the thing it describes. Start with the basics, or jump straight to a project.

Ask a question or share what worked

Your email address will not be published. Required fields are marked *