Skip to main content

Overview

This page give you an overview of Telar Scoial UI and things are working together in frontend.

Telar Social UI Tools

info

Find Telar Social UI repository here.

Directory Structure#

root-directory
โ”œโ”€โ”€ src
โ”‚ โ”œโ”€โ”€ api
โ”‚ โ”œโ”€โ”€ assets
โ”‚ โ”œโ”€โ”€ components
โ”‚ โ”œโ”€โ”€ config
โ”‚ โ”œโ”€โ”€ constants
โ”‚ โ”œโ”€โ”€ containers
โ”‚ โ”œโ”€โ”€ core
โ”‚ โ”‚ โ”œโ”€โ”€ domain
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entityName1
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entityName2
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”‚ โ”œโ”€โ”€ factories
โ”‚ โ”‚ โ””โ”€โ”€ services
โ”‚ โ”‚ โ”œโ”€โ”€ entityName1
โ”‚ โ”‚ โ”œโ”€โ”€ entityName2
โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”œโ”€โ”€ data
โ”‚ โ”‚ โ”œโ”€โ”€ webAPI1
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ services
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entityName1
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entityName2
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”‚ โ”œโ”€โ”€ webAPI2
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ services
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entityName1
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entityName2
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”œโ”€โ”€ layouts
โ”‚ โ”œโ”€โ”€ lib
โ”‚ โ”œโ”€โ”€ locales
โ”‚ โ”œโ”€โ”€ models
โ”‚ โ”‚ โ”œโ”€โ”€ entityName1
โ”‚ โ”‚ โ”œโ”€โ”€ entityName2
โ”‚ โ”‚ โ””โ”€โ”€ ...
โ”‚ โ”œโ”€โ”€ routes
โ”‚ โ”œโ”€โ”€ sotre
โ”‚ โ”‚ โ”œโ”€โ”€ actions
โ”‚ โ”‚ โ”œโ”€โ”€ reducers
โ”‚ โ”‚ โ””โ”€โ”€ sagas
โ”‚ โ”œโ”€โ”€ styles
โ”‚ โ”‚ โ”œโ”€โ”€ base
โ”‚ โ”‚ โ””โ”€โ”€ components
โ”‚ โ””โ”€โ”€ typings
โ””โ”€โ”€ public

Directory Descriptions#

  • React Components: We devided react components components in three parts. The component which is stateless, we keep in src/layouts. The src/containers including master components which we use router to load these components. The src/components in including state components.
  • State Management: The src/store including directories managing redux store states. The store/actions including actions creators. The store/reducers including redux reducers. The store/sagas including saga files from redux-saga to manage side effects such as asynchronous things like data fetching. contains example documentation files written in Markdown.
  • Web API Service: The website/blog-examples-from-docusaurus directory contains examples of blog posts written in markdown.
  • Core Management: We keep the src/core as a most stable layer that includes core/domain including Web API Service class entities, core/factories including factory interface and class for Web API Service classes and core/services including main interfaces for Web API Service in src/data directory.

General Frontend Flow#

General Frontend Flow

To manage states in frontend side, Telar Social has a simple implementation of Redux. Follow above diagram Components emit an action from Actions. If the action is a direct change on state in Redux Store Reducers will execute that action. If the action is async or needs to call an async web api Sagas will execute that action.

Sagas is a layer that manage side effects. Using redux-saga library we can handle async actions easier.

Asynchronous things like data fetching and impure things like accessing the browser cache) easier to manage, more efficient to execute, simple to test, and better at handling failures. redux-saga doc

General Frontend Flow

Sagas layer using IOC container to access the Web Service API. When async action is done, saga will call another action to change respective state in (https://redux.js.org/api/store).

Using IOC Container#

Thanks to InversifyJS we are able to implement javascript project that adheres to the SOLID principles. With this we can have different implementation from Data or Web Service API layer. With the least changes are able to have different solutions for backend such as server-less, docker, and etc.

General Frontend Flow

โญ๏ธ This page needs help. Please help with your contribution. To start click on edit button.