Frontend architecture

Already chosen

React

Webpack

 

In progress

vs

Final encounter coming soon!

ES experiment FTW!

To be decided!

Application state manager

 

Why?

  1. Big community backup
  2. Small and concise
  3. Easily extendable
  4. A lot of plugins / libs
  5. One central state
  6. Great developer experience
    • Redux tools
    • Time travelling
    • Hot reloading

Cons

  1. Not opinionated - lots of ways to achieve the same result
  2. A bit of boilerplate to write
  3. No "batteries included" 

Alternatives

  1. Other Flux-ish libraries
  2. GraphQL / Falcor
  3. Baobab
  4. Pure React state

Voting time!

State object

Why?

  1. Made and supported by Facebook
  2. Immutability
  3. Convenient API
  4. Lots of helpers to transform state
  5. Objective - functional mix feels good
  6. Battle tested with Redux - deep state comparing works great

Cons

  1. Not a pure JS object
    • Interoperability is not perfect
    • Need getters, .toJS() or Records for getting values
    • Harder to debug

Alternatives

  1. Ramda JS
  2. Seamless-immutable
  3. POJO

Voting time!

Testing

Enzyme

Karma

  1. Very popular combination
  2. Run tests in real browsers (even BrowserStack)
  3. Easily test output of React components with Enzyme
  4. Familiar expect syntax with Chai

Why?

  1. Need some initial setup and configuration

Cons

Voting time!

Folder structure

* frontend (<-- apps go here)
  |-- apps
      |-- Build
          |-- index.js (<-- entry file)
          |-- components
              |-- PostItItem
                  |-- PostItItem.js
                  |-- PostItItem.spec.js
                  |-- PostItItem.css
                  |-- package.json
          |-- containers
              |-- PostItItemContainer.js
          |-- actions
              |-- postIts.js
          |-- reducer
              |-- postIts.js
  |-- lib (<-- shared stuff we created)
      |-- components
      |-- utils
      |-- etc.
  |-- vendor (<-- shared stuff others created)

Alternative

* frontend (<-- apps go here)
  |-- apps
      |-- Build
          |-- index.js (<-- entry file)
          |-- PostIts
              |-- postItActions.js
              |-- postItsReducer.js
              |-- PostItItem.js
              |-- PostItItem.spec.js
              |-- PostItItem.css
              |-- PostItsList.js
              |-- PostItsList.spec.js
              |-- PostItsList.css
              |-- PostItsListContainer.js
              |-- PostItItemContainer.js
  |-- lib (<-- shared stuff we created)
      |-- components
      |-- utils
      |-- etc.
  |-- vendor (<-- shared stuff others created)

Voting time!

Not covered

  1. CSS
  2. Smooth Backbone -> Redux transition

deck

By Lucjan Suski

deck

  • 311