...
Key Concepts
Clean #API Architecture
Rajg
The pattern you need — or probably had but didn’t realize
Frameworks
Any endpoint request must be routed to the appropriate code path through a Load Balancer, Web Server, Application Server, and an API / Web Framework.
Interface adapters
Once a request comes in via our framework, a Controller orchestrates the processing of the endpoint by invoking a Request object to extract each parameter, validate its syntax, and authenticate the user making the request.
Controllers are the first place our application code is introduced. Controllers instantiate our classes and move data between classes in the 🔴 Application Logic layer.
It’s important to note that Controllers are not the only orchestration object in the Interface adapter layer.
Application Logic
GET request made to read endpoints are next passed to the Application Logic layer where a Service ensures the validity of the inputs, makes sure the user is authorized to access data, and then retrieves data from the Entity Logic Layer through a Repo (for databases) and/or Adapter (for APIs). Service objects return Result objects as defined by dry-monads.
POST, DELETE and PUT requests made to write endpoints do the same thing as read endpoints, but defer processing by enqueuing Service inputs through our queue — Amazon SQS — and write the data to the Entity Logic Layer through a Job or Service.
Entity logic
Entity logic refers to components that are common not only to this endpoint, but others as well. Repository classes, which provide us access to persistent stores like Mysql or Postgres databases, and Adapter classes, which provide us access to APIs, including AWS storage apis like S3, Elasti Cache and others. We expect classes in this layer to be used over and over again; classes in the layer above are often single-purpose to an endpoint.
Data
Source: Eric Silverberg
Potential Value Opportunities
Potential Challenges
Candidate Solutions
Step-by-step guide for Example
...