Our example for the whole course: a To-Do app
Everything in this course is built around one simple example: a To-Do list app. You sign up, log in, add tasks like “Buy milk”, tick them off, and delete them. By the last lesson you'll have written the complete backend for it, with a real database. Keep this app in your head; every new idea is a new piece of it.
The restaurant picture
Think of a restaurant:
- You (the customer) = the app on a phone or browser. This is the frontend.
- The menu = the API: the list of things you're allowed to order.
- The waiter = the internet, carrying your order and bringing back the food.
- The kitchen = the backend. It cooks, checks rules (“sorry, we're out of that”) and serves.
- The store room = the database, where all the ingredients (data) are kept.
You never walk into the kitchen. You only order from the menu. That's exactly how apps talk to backends.
One request, start to finish
When you tap “Add task” in the To-Do app, this happens in less than a second:
- 1
App sends a request
POST /api/tasks with the data { "title": "Buy milk" }.
- 2
It travels over the internet
Using HTTP, the language of the web.
- 3
Backend checks it
Is the user logged in? Is the title empty? Rules first.
- 4
Backend saves it
The task goes into the database (PostgreSQL).
- 5
Backend sends a response
Status 201 and the new task as JSON.
- 6
App shows it
"Buy milk" appears in your list.
What a request is made of
Every request has up to four parts. Here they are for “add a task”:
| Part | What it is | Example |
|---|---|---|
| Method | The verb: what you want to do | POST |
| URL (path) | The noun: which thing | /api/tasks |
| Headers | Extra info, like who you are | Authorization: Bearer <token> |
| Body | The data you send (for POST/PATCH) | { "title": "Buy milk" } |
The 5 methods you'll use every day
The method is the verb. With just these five you can build almost any API:
| Method | Means | To-Do example |
|---|---|---|
| GET | Read (never changes anything) | GET /api/tasks → list my tasks |
| POST | Create something new | POST /api/tasks → add a task |
| PATCH | Change part of something | PATCH /api/tasks/5 → mark task 5 done |
| PUT | Replace the whole thing | PUT /api/tasks/5 → replace task 5 completely |
| DELETE | Remove it | DELETE /api/tasks/5 → delete task 5 |
The response: a status code and JSON
The backend always answers with a status code (a 3-digit number saying how it went) and usually a JSON body:
{
"id": 1,
"title": "Buy milk",
"done": false
}JSON is just text that looks like a JavaScript object: keys in double quotes, values that are text, numbers, true/false, lists or other objects. Every programming language can read it.
Status codes you must know
The first digit tells you the story: 2 = success, 4 = you (the app) made a mistake, 5 = the server broke.
| Code | Name | When our To-Do API sends it |
|---|---|---|
| 200 | OK | Here are your tasks / here's the updated task |
| 201 | Created | Your new task (or account) was made |
| 204 | No Content | Task deleted, nothing to send back |
| 400 | Bad Request | The title is empty or the JSON is broken |
| 401 | Unauthorized | You're not logged in (no token, or it expired) |
| 403 | Forbidden | You're logged in but not allowed to do this |
| 404 | Not Found | There's no task with that id (or it isn't yours) |
| 409 | Conflict | An account with this email already exists |
| 500 | Server Error | A bug on our side. Never the user's fault |
The full menu of our To-Do API
Here's every endpoint you'll build in this course. An endpoint is one method + one URL:
| Endpoint | What it does | Login needed? |
|---|---|---|
| POST /api/auth/register | Create an account | No |
| POST /api/auth/login | Log in, get a token | No |
| GET /api/tasks | List my tasks (page by page) | Yes |
| GET /api/tasks/:id | Get one task | Yes |
| POST /api/tasks | Add a task | Yes |
| PATCH /api/tasks/:id | Change a task (title or done) | Yes |
| DELETE /api/tasks/:id | Delete a task | Yes |
:id means “put a number here”, like /api/tasks/5. That's called a URL parameter. Extra options after a ?, like /api/tasks?page=2, are query parameters.
The tools we'll use (and why)
| Tool | Its job | Why this one |
|---|---|---|
| Node.js (JavaScript) | Runs JavaScript on a server | The most used way to build web backends with JavaScript |
| TypeScript | JavaScript with types | Catches mistakes before you run the code (next lesson) |
| Bun | Runs our code and installs packages | One fast tool, runs TypeScript directly, no setup |
| Express | Makes writing APIs easy | The most popular, simplest Node.js web framework |
| PostgreSQL | The database | Free, reliable, used by companies of every size |
| Prisma | Talks to the database for us | Write data code in TypeScript, get tables made for you |
Key takeaways
- The frontend is what you see; the backend stores data and applies rules; the API connects them.
- Every request has a method and a URL, and sometimes headers and a JSON body.
- Use plural nouns for URLs and HTTP methods for actions (REST style).
- Status codes tell the app what happened: 2xx good, 4xx client mistake, 5xx server bug.
- We'll build one To-Do API through the whole course: auth plus five task endpoints.
Frequently asked questions
What is a backend in simple words?
The backend is the part of an app you don't see. It runs on a server, keeps the data (users, tasks, orders) in a database, checks who is allowed to do what, and sends answers back to the app on your phone or browser.
What is an API?
An API is the list of requests a backend understands, like a restaurant menu. Each item has an address (URL) and a method (GET, POST…). The app orders from the menu; the backend cooks and serves the answer as JSON.
What is the difference between frontend and backend?
The frontend is what users see and click (the screens). The backend is the server behind it that stores data and applies the rules. They talk to each other through the API.
What is REST?
REST is a popular, simple style for designing APIs: things are 'resources' with URLs (like /api/tasks), and HTTP methods say what to do with them (GET to read, POST to create, PATCH to change, DELETE to remove).
Do I need to know frontend before backend?
No. You only need basic programming (variables, functions, if/else, arrays, objects). This course starts from zero backend knowledge.
🧠 Quick check: backend basics
1. The app wants to show all your tasks. Which method does it use?
2. You created a new task successfully. Which status code is best?
3. You ask for /api/tasks/999 but there's no task 999. The server replies…
4. Which format do almost all modern APIs use to send data?