What is a Server?

A server is just a computer that never sleeps.

▶ the lesson · narrated sketch video · tap for sound

the intro

A server is any computer that answers requests. Your browser asks for a page or data, the server responds, and the cycle repeats millions of times a day. Understand the request-response cycle and the rest of backend stops being magic.

fun fact ✦

A server can be a $5 Raspberry Pi under your desk — “server” is a job, not a size.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

Here is the reframe that makes everything click: server is a role, not a species of machine. Software that sits still, listens, and answers whoever asks is a server, and any computer can play that role, including the one you are reading this on. Your laptop is a client all day and can be a server by night.

a role, not a machine

your browserthe internetthe serverthe database
the cast of every request: ask, travel, answer, remember

key terms

client

The side that asks first. Browsers and phones are clients, but so is any program that sends a request.

your browser, right now

request

The message a client sends: an address, a method like GET, and optional data.

GET /cats?page=2

response

The server's reply: a status code saying how it went, plus usually a body of data.

200 OK + JSON

listen

What a server does between requests: nothing dramatic. It waits on a port for the next ask.

listening on :3000

how it works

  1. 1
    Someone asks

    A client sends a request to the server's address: a method, a path, sometimes a body.

  2. 2
    The server answers

    Code runs: validate the ask, maybe read or write the database, build a reply.

  3. 3
    Status first, body second

    Every response carries a status code, 200 fine or 404 missing or 500 on fire, then the data.

  4. 4
    Then everyone forgets

    HTTP has no memory between requests. Each one arrives alone, which is why cookies and tokens exist.

the code, explained

a server is one command away — this machine is now answering

1$ node tiny-server.js
one command turns this machine into a server
2listening on http://localhost:3000
3
4$ curl localhost:3000/cats
a client asks — same loop, no browser needed
5meow. (status 200)
the response: proof of life in five bytes

side by side

the server

  • waits, then answers
  • fixed address, always on
  • owns the data and rules
VS

the client

  • asks, then waits
  • comes and goes freely
  • renders what arrives
file serverapp serverDB server
same trick, different cargo: every kind of server answers requests
💡 tip

Try it in thirty seconds: run npx serve in any folder and open the printed address from your phone. Congratulations, two devices just did client-server over your wifi.

quick answers

Does a server need to be a big expensive machine?

No. A five dollar Raspberry Pi serves real traffic. What matters is that it answers, stays reachable, and does not fall over.

Is the frontend running on the server too?

Often, but conceptually no. The server sends files and data; the browser runs the frontend. They are different jobs even on the same machine.

Web server vs API server — different things?

A web server ships pages and files. An API server ships data, usually JSON. Same request-response loop, different payload.

quick hits about What is a Server?

short answers · interviews, tips, trivia & hidden gems

🎤 interview

Client or server — who owns the truth?watch ↗

🎤 interview

API or endpoint — same thing?watch ↗

📚 tutorial

What does one request look like?watch ↗

🔧 useful

What is localhost, really?watch ↗

🧠 trivia

How big must a server be?watch ↗