toolrota

Frontend vs backend: how the front and back of a web app work together

The part of a website you see is the frontend; the part that runs in the background is the backend. We explain the difference and how they communicate.

Serkan Akyürek··3 min read
Frontend vs backend: how the front and back of a web app work together – SaaS & Cloud

When you visit a shopping site, the product cards, buttons and menus you see are the frontend. Checking stock when you add to the cart, saving the order and processing payment happen on the backend. You can think of the two layers like a restaurant's dining room and kitchen: the customer sees the dining room, and the food is made in the kitchen.

Key differences

FeatureFrontendBackend
Where it runsThe user's browser or deviceServer or cloud
JobInterface, interaction, lookData, business rules, security
Typical technologiesHTML, CSS, JavaScript and frameworksNode.js, Python, PHP, Java, databases
FocusUser experience, speed, accessibilityCorrectness, scaling, security
What happens when you click a button?
  1. 1

    The frontend detects the click

  2. 2

    It sends the needed information as an API request

  3. 3

    The backend validates the request and runs the business rule

  4. 4

    It reads or updates the database

  5. 5

    It returns the result as JSON

  6. 6

    The frontend updates the screen

For details of the communication see our API guide, and for the data format our JSON guide.

Parts of the backend

  • Server: the machine or cloud service the code runs on; see our VPS and serverless guides.
  • Database: user, product and order data; see our database guide.
  • Authentication: sign-in, permissions and sessions; see our OAuth guide.
  • Cache: speeding up frequently used data; see our cache guide.

Why does security live in the backend?

Frontend code runs on the user's device, so it can be changed. That's why critical work such as price calculation, permission checks and validation must always happen in the backend. Checks in the frontend only improve the user experience.

Career angle

  • Frontend developer: turns designs into code and focuses on performance and accessibility.
  • Backend developer: works on APIs, databases and server architecture.
  • Full stack developer: is capable on both sides.

For beginners our guide to starting coding with AI can help.

Common mistakes

  1. Doing security checks only in the frontend.
  2. Putting API keys in frontend code.
  3. Thinking frontend and backend are the same thing.
  4. Showing backend details to users in error messages.

Frequently asked questions

Does a static website have a backend? Simple static sites may not; once you add forms or accounts, you need a backend.

Which is easier to learn? The frontend lets you see results immediately, which is motivating at the start; the choice depends on your interests.

Summary

The frontend is the face the user sees and the backend is the kitchen where the work happens. They work together through APIs, and security is always enforced in the backend.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.

Related guides

SaaS & Cloud