Statelessness vs Server Sessions

Statelessness does not mean that the application has no state. Databases contain state, caches contain state, and users have persistent data. It means the server does not depend on hidden conversational state from a previous request to understand the current request.

For example, if a request contains a bearer token, the server can validate the token and determine the caller without depending on an in-memory session on a particular server instance.

Stateless APIs simplify horizontal scaling because any healthy server instance can process the request.

Important

Statelessness is about request context, not the absence of persistent application state.

Stateless Request Processing