DDD – Could REST API Be Considered a Presentation Layer?

domain-driven-designdomain-model

I read a lot of questions about this concern, and some of them are

Presentation VS Application layer in DDD

Application layer vs domain layer?

So my question is if the top layer is REST API and there is no need for any UI, is REST api considered as a presentation layer or application layer?

Update

Since I received some comments how this question has nothing to do with DDD and that there is no presentation layer in DDD etc, not to confuse application layer in OSI etc.., I decided to add this .

It appears that there is also an distributed interfaces layer that would actually handle this scope.

So basically presentation layer is a part of DDD architecture, just not the heart of this architecture. Also web services in a form of .net web api (rest) would exist in this distributed interfaces layer.

enter image description here

Best Answer

REST is a protocol and convention that sits on top of HTTP. It is neither the Application Layer nor the Presentation Layer. It isn't considered part of the OSI model at all.

HTTP is considered the Application layer.

Don't confuse the Application Layer in DDD with the Application Layer in the OSI Model; they are not the same thing. DDD does not appear to have a Presentation Layer in practice.

A "Layer of Abstraction" is just that; a layer of abstraction. It's a place for you to put code and to establish API protocols. Your abstraction may differ from mine. There's no "one ring to rule them all," nor is there "The One True Way."

Related Topic