DEV Community

Darshan Modi
Darshan Modi

Posted on

What Actually Happens When an API Request Hits Your Backend?

Ever wondered what happens after you click "Send" on an API request?

A typical backend request goes through these stages:

Client
↓
HTTP Request
↓
Middleware
↓
Parsing
↓
Validation
↓
Authentication
↓
Authorization
↓
Business Logic
↓
Database
↓
HTTP Response
↓
Client

Each stage has a different responsibility.

  • Parsing → Understand the incoming data
  • Validation → Check whether the data is valid
  • Authentication → Who are you?
  • Authorization → Are you allowed to do this?
  • Business Logic → What should the application do?
  • Database → Store or retrieve data
  • Response → Send the result back to the client

Understanding this flow helped me stop thinking of an API as just a route and start seeing it as a complete request lifecycle.

That's the foundation I'm building as I learn backend engineering. 🚀

backend #javascript #nodejs #webdev

Top comments (0)