Search code examples
architecturedomain-driven-designsoftware-designclean-architecture

How to apply Clean Architecture when Application requires Use Cases to be executed on Client and Server


let's assume you have an application that requires application (layer?) specific logic on both, the client and the server. E.g. in case of an offline mode or CPU heavy tasks.

First: is Clean Architecture still a proper abstraction/ software architecture?

Assuming yes, I started thinking of extending the Command/Query Bus in such a way, that it could delegate those requests to the client or the server.

Would this be a proper approach?

EDIT:

Example 1: I want to annotate PDFs & model some charts always locally but upload them afterwards.

Example 2: I want to text search my locally available documents, if the remote storage is not available (e.g. no internet connection/ offline mode).


Solution

  • Some time has passed and our code architecture is pretty validated:

    we simply chose to have the default CA project structure. Once for the client and once for the server side:

    Client:

    • presentation layer
    • infra layer
    • app layer

    Server:

    • api layer (is analogous to the client side presentation layer)
    • infra layer
    • app layer

    Shared projects/layers:

    • domain layer (rich domain)
    • and a projects for the dtos/ error types etc (name it as you like)

    Design conciderations:

    • the infrastructure layer of the client handles the communication with the api layer of the server
    • for that the application layer on client side defines an interface for any api command which the infrastructure layer on client side implements