Backend and data: check the rule behind the screen
Good to see you again! In the last lesson, Member A's button sent a request to the server. Now let's look at the server's side, where the real work happens.
In this lesson, you'll learn:
- what the backend does;
- why data must be stored so that it lasts;
- the difference between "who are you?" and "what may you do?";
- why important rules must be checked behind the screen.
Why it matters: this is where real money and private information are protected, or put at risk.
The backend does the work behind the screen
The backend is the part of an app that runs on the server. People never see it. When the committee's request arrives, the backend:
- checks that the request makes sense;
- finds the payment records it needs;
- works out the total;
- sends the answer back.
The frontend only shows the answer. The backend is where the app's rules are actually applied.
Not every app has a backend. Some apps work entirely on one device. But most apps that share data between people, like our committee app, do have one.
Why data must last
The committee's records must still be there tomorrow, after everyone closes the app. A value that lives only inside a running program disappears when the program stops.
Keeping information so that it's still there later is called persistence. Apps usually keep their data in a database: an organised store of information that software can read and change.
Be careful with the word "Saved". Compare:
| What you see | What it proves |
|---|---|
| The page says "Saved" | Only that the page showed a message |
| You close the app, open it again, and the record is still there | That the record really was stored |
The second is much better proof. Keeping records safe even when a computer breaks takes more planning, and that comes later in the book.
Who are you, and what may you do?
Say Member A has signed in. The app now has to answer two different questions:
- Who are you? Checking that a person really is who they say they are is called authentication. A password is one way to do it.
- What may you do? Checking what that person is allowed to do is called authorization.
Being signed in as Member A doesn't mean you may change Member B's record. In our committee, members can see the totals, but only the organiser may correct a record.
Here's the important part. Suppose the frontend hides the Edit button from members. That protects nothing, because people can send requests to the server without using the app's buttons at all. So the backend must check permission on every request. Hiding a button is not a lock.
Checking what people send
Validation means checking that the information sent follows the rules: for example, that an amount is a number and isn't missing.
The frontend can check this early, so the person can fix a mistake quickly. That helps. But the backend must check again, because a request might not come from your frontend at all, or might have been changed on the way. Checks that protect the records belong in the backend.
When the backend refuses a request, it should say clearly why. And the screen must never show "Success" when something failed.
What must happen before the public uses it
Deployment means putting software where its users can reach it, for example on a server connected to the internet.
An app that works on your own laptop is not yet ready for the public. Public use brings new questions: who can get in, how private data stays private, how to recover when something fails, and what it costs to keep the app running.
One protection you'll see everywhere is HTTPS. It scrambles information while it travels between the browser and the server, so people watching the connection can't read it. It doesn't make the app's rules or its stored data correct. That is still the backend's job.
Safety floor
Never put real members' details, passwords or financial records into a practice example, or into a message to an AI tool. Never treat a hidden button as protection. Before real people use an app, its permissions, data handling and recovery must be built and checked by someone who understands them.
Check what you can now explain
From memory:
- Member A is signed in. Why might the app still refuse to let them change a record?
- Why is "the record is still there after reopening the app" better proof than a "Saved" message?
- Which checks can the frontend do to help people, and which must the backend do as well?
In the next lesson, we'll put all the parts together, and see why a quick shortcut can cost a lot later.