Unit 1 · Web architecture and protocols
Web architecture describes how clients, servers, data stores, and external services collaborate. A monolith packages many responsibilities into one deployable unit. This can be simple to develop and deploy, but unrelated changes may become coupled. A layered design separates presentation, application logic, domain rules, and persistence so each layer has a clearer responsibility.
Browser <-> HTTP API <-> Application services <-> Database
| |
JSON External serviceClient-server architecture assigns responsibilities across a network boundary. The client presents information and captures intent; the server owns authoritative rules and data. The boundary is also a trust boundary: client checks improve usability, but server checks protect the system.
REST models resources and representations. A resource might be a course, enrollment, or profile. Uniform HTTP semantics make APIs easier to understand: GET /courses/466 retrieves a representation, while POST /enrollments creates a new relationship. Stateless requests, cacheable responses, a uniform interface, and layered intermediaries are useful constraints, not mandatory decorative labels.
1. Where should authoritative business rules execute?
2. What does stateless mean for an HTTP request?
3. Is REST a JavaScript library?
A small course service may start as a monolith because one deployment and one database reduce operational complexity. Its internal layers can still isolate HTTP, domain rules, and persistence. The server validates the student and course, performs the enrollment transaction, and returns 201 or a useful error. An external email provider should be treated as a dependency that can time out; enrollment success should not silently depend on an unbounded email call.