https://github.com/askides/clean-architecture-react
Clean Architecture Example Using React.js
https://github.com/askides/clean-architecture-react
clean-architecture clean-code reactjs
Last synced: about 1 year ago
JSON representation
Clean Architecture Example Using React.js
- Host: GitHub
- URL: https://github.com/askides/clean-architecture-react
- Owner: askides
- Created: 2023-01-06T16:15:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T15:08:17.000Z (over 3 years ago)
- Last Synced: 2024-04-28T03:47:57.844Z (about 2 years ago)
- Topics: clean-architecture, clean-code, reactjs
- Language: TypeScript
- Homepage:
- Size: 139 KB
- Stars: 149
- Watchers: 6
- Forks: 24
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Clean Architecture React
This project is an experiment in applying clean architecture with React.
## Important
Inside a React context, Clean Architecture will always be some kind of adaption. The key is separation of concerns and decoupling dependencies. In addition, the project originated as an example for personal study, if you want to make a suggestion go ahead and PR!
## Architecture
### Models
- User
- Todo
### Repositories
- TodoRepository
- UserRepository
### DataSources
- User
- UserAPIDataSource (From a REST API)
- Todo
- TodoAPIDataSource (From a REST API)
- TodoLocalStorageDataSource (From Browser Local Storage)
### UseCases
- useClearTodos
- useCreateTodo
- useFetchTodos
- useFetchUsers
These use cases are implemented using react-query, a library for fetching and caching data in React applications.
The Todo model has two data source implementations available: one using a REST API and the other using local storage.
### Services
- Http (Abstraction over axios)
- Notification (Abstraction over alert)
- Logger (Abstraction over console.log)