Lesson 2 of 296
Front end, back end, database and full stack
What you will learn
- The three main parts of a web application
- What each part does and which languages it uses
- What an API is
- What "full stack developer" means
On this page
The three parts
Almost every web application has three parts.
| Part | What it is | Where it runs |
|---|---|---|
| Front end | Everything the user sees and touches | In the user's browser |
| Back end | The logic and rules the user does not see | On a server |
| Database | Where the data is stored permanently | On a server |
Front end
The front end is the part in the browser: text, buttons, forms, colours, menus. It is built with three languages.
- HTML: the content and structure (headings, paragraphs, buttons).
- CSS: the look (colours, sizes, layout).
- JavaScript: the behaviour (what happens when you click).
Developers often use a tool such as React to build large front ends faster. You will learn it in Part 12.
Back end
The back end is code that runs on the server. The user never sees it. It does jobs such as:
- checking that a password is correct
- deciding who is allowed to see what
- working out prices and totals
- saving and reading data from the database
- sending emails
Back end code can be written in many languages: JavaScript (with Node.js), PHP, Python, Java and others. This course uses JavaScript and TypeScript with Node.js, so you use one language on both sides.
Database
A database stores data so it is not lost when the server restarts. Users, orders, messages and products all live in a database. A common type is the SQL database, where data is kept in tables with rows and columns, like a spreadsheet. PostgreSQL and MySQL are two examples. You will learn SQL in Part 17.
API: how the front end talks to the back end
The front end cannot read the database directly. It must ask the back end. The way it asks is called an API (Application Programming Interface).
An API is a list of requests the back end agrees to answer. For example:
| Request | What the back end does |
|---|---|
GET /products | Sends back the list of products |
POST /login | Checks the email and password |
POST /orders | Saves a new order |
The data is usually sent in a text format called JSON. It looks like this:
{
"name": "Blue T-shirt",
"price": 1200,
"inStock": true
}Example: logging in
- You type your email and password and click "Log in". (Front end)
- The browser sends a request to the server with the email and password. (API)
- The server code looks for that email in the database. (Back end + database)
- The server checks the password and decides: correct or wrong. (Back end)
- The server sends a response: "success" or "wrong password". (API)
- The page shows your account or an error message. (Front end)
What is a full stack developer?
A full stack developer can build all three parts: the front end, the back end and the database, and can connect them. "Stack" means the set of tools used together. A common modern stack, and the one this course teaches, is:
- Front end: HTML, CSS, TypeScript, React, Next.js
- Back end: Node.js, NestJS
- Database: PostgreSQL
Common mistakes
- "Front end means design." A designer decides how a page should look. A front end developer writes the code that makes it work in the browser.
- "Security checks can be done in the front end." Never trust the front end. A user can change anything that runs in their own browser. Every important check (passwords, prices, permissions) must be done again on the back end.
How to say it in an interview
"The front end runs in the browser and handles what the user sees, using HTML, CSS and JavaScript. The back end runs on a server and holds the business logic and security. The database stores the data. The front end talks to the back end through an API, usually sending JSON over HTTP. A full stack developer works across all of these."
Key words
| Word | Meaning |
|---|---|
| Front end | The part of an app that runs in the browser |
| Back end | The part that runs on the server |
| Database | Permanent storage for data |
| API | The list of requests a back end accepts |
| JSON | A text format for sending data |
| Stack | The set of technologies used together in a project |
Now prove it
This lesson is complete when you pass the quiz and all three practice levels.