What is stateless interaction?
Stateless interaction is a way for a client and a server to communicate where the server does not store information about the client's previous requests.
In simpler terms: every request behaves like the first and only one.
What "stateless" means in plain words
If an interaction is stateless:
- the server does not remember the client
- the server does not remember past requests
- all the necessary information must be in every request
The server processes the request, sends the response, and forgets everything.
What this looks like in practice
The client sends a request:
"Give me user 123's data, here is my token"
The server:
- checks the token
- processes the request
- sends the response
- does not store the client's state
The next request:
"Give me user 123's order list, here is my token"
For the server, this is a completely new request, even if it came from the same client.
A real-life example
Stateless is like a line at an information desk:
- you walk up
- you ask a question
- you get an answer
- you walk away
If you come back again, the clerk is not obligated to remember what you asked before. You have to explain everything from scratch again.
Where statelessness shows up most often
The best-known example is HTTP:
- every HTTP request is independent
- the server does not store session state by default
- login, tokens, parameters, all of it is passed in the request
Cookies, tokens, and sessions are ways to work around statelessness, not to eliminate it.
Why statelessness is a good thing
Advantages:
- simplicity of server logic
- scalability (any server can handle the request)
- reliability (servers do not depend on state memory)
- convenient for distributed systems
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.