Skip to content

kazoogon/frontend_with_cleanArchitecture

Repository files navigation

🛤 Frontend simple TODO app with clean architecture

🙄 How to run this app

$ yarn install
$ yarn start

🏗 Architecture in this app

directories

name explanation
components/ Store presentation(view, UI) layer.
Should be organize with atomic design for example, but later.
domain/ Store domain layer. Entities and repository looks they should be in data directory, but in order to dependency inversion, they depends on domain layer
data/ Store data layor (repository and data)
di/ Store Dependency Injection codes

Layers

layer

🤔 What is clean architecture?

I'm not gonna here explain deeply, but as you can see clean architecture is similar to game structure
From this youtube video
simple_architecture

And this is famous architecture image, eyes automatically focus on big circle image, but right bottom image is also important

You can easily see architecture flow with that gaming image

⭐ About Presenter in frontend

It was difficult how to handle with presenter in frontend architecture, because frontend is UI itself

😎 Connection with SOLID principle

After enjoying Clean Architecture, I thought there are two important things in it.

1. separate of concerns
2. control dependency direction by using interface

Now let's think about number 2
If you have learned SOLID principle, would remind you of Dependency Inversion
I explained about Dependency Inversion with image

(Clean architecture and SOLID principle are written by same person, Robert C. Martin.)

🗒 TODO

  • remove data button (local storage)

💡 References

🖥 🇯🇵 youtube in Japanese
easiest way to understand what is clean architecture if you understand Japanese

📗 react with clean architecture, github source code
I think this code is more real world code than mine, you even could get how to handle with web and mobile by using adapter

etc

After trying to make this one, honestly I thought clean architecture is too complicated, because we don't use often useCase and repository effectively.

So presentational and container pattern might be simpler and better way.

simply put, this pattern is that separating business login component and UI component.