You are never alone 🤲
If you need banking features, don’t build a Bank - integrate with it…
Custom Coding Low-Code No-Code
Crafting a Third-Party
Banking Library with Web
Components and React
Nice to meet you 🤝
● Software Engineer at Unit
● Was born in Zhytomyr 󰑒
● Studied Cyber Security 🔐
● Former Radio and Wedding host 🎤
● Moved to Israel 󰏛 in 2017
● Writing in TS and Scala
● Don’t want to write a lot of code
● No impact on my app
● Minimal documentation reading
● Designer must be satisfied
● Compatible with my framework
● Should be fast
Using 󰞦
● Don’t want to write a lot of code
● No bugs, please
● No client specific features
● Write with favorite framework
● Should work everywhere
● Business needs to serve throw CDN for
regulatory issues
Building 󰠻
🧐 Which options do we have?
💡 We can build React, Angular, Vue, Ember... whichever library? 😔
💡 We could use <Iframe>? 😔
💡 Maybe classical way of exposing functions? 😔
󰠻👍 One more thing
Web Components
Key features 🔑
Shadow DOM
Encapsulation
󰞲
Custom Elements
Way to create new
HTML elements
👻
Slots
Placeholders
🚮
󰞲 Custom elements <component> </component>
🪴 Shadow DOM helps with DOM pollution
🪴 Shadow DOM helps with DOM pollution
🚮 <slot> </slot>
󰠻 Why?
● Widely supported across all browsers
● Framework-independent
● Declarative
● Encapsulation
● Fail safe (calling an HTML element which doesn’t exist does not cause
an error)
😨 What about framework?
Lit
Stencil
React
“React and Web Components are built to solve different problems.
Web Components provide strong encapsulation for reusable
components, while React provides a declarative library that keeps
the DOM in sync with your data. The two goals are complementary.
As a developer, you are free to use React in your Web Components,
or to use Web Components in React, or both.”
🤨 Is it ok to use React?
But in a real world…
We ended up with this
📡 Communication
Web Component
React Application
const ui = function(state)
Web
Component
Web
Component
Main App Elements
Main App Elements
You can request to refresh component
⚙ Custom Events
⚙ Custom Events
You can listen to onload
Reflect on async changes
⚙ Custom Events
󰞦
Enough of me, how can you use it?
Demo
So each view is component
󰠻 Event Bus (sub / pub pattern)
To ensure a React component receives events meant
specifically for it, we utilize a dedicated event bus for each
web component. The event bus has two key functions:
eventbus.publish() Receives data and publishes an even
encapsulating that data. Internally it creates a new
CustomEvent.
eventbus.subscribe() Tells the event bus to add an event
listener This is the way to get event that WE KNOW was
addressed to us.
📱 Can we do something for Native (iOS, Android)?
Web View Native Experiences
😬 How can we achieve it?
Card
App own UI
Component
App own UI
Component
Web view
Menu
🤔 What if we change it a bit?
Card
App own UI
Component
App own UI
Component
Web view
Card
App own UI
Component
App own UI
Component
Web view
Bottom Sheet
Web view
{ Event }
󰞦
What's going on here? Can you prove it?
💪 How are we working?
Atomic Design Methodology
Atoms Molecules Organisms Templates Pages
🧪 How are we theming?
Global Settings
Theming
Default Settings
Component Setting
The @layer CSS at-rule is used to declare a cascade
layer and can also be used to define the order of
precedence in case of multiple cascade layers.
🚀 How are we performing?
📦 General
● We use Storybook for development
● We follow Semantic Versioning. Each version
is a new file.
● We keep the right to deploy regulatory
changes to existing versions using cherry pick
● We use Cypress for UI tests
● We have security check in CI process
● We deploy preview for each PR
🎁 Takeaways
● While building client libraries, put yourself in junior pants 👖 Always
choose best possible interfaces
● Be native and clear in your interfaces
● React is not framework for SPA, it’s just a library
as jQuery 💔💀 was
● Everything is possible, don’t work too much
Q&A

"Crafting a Third-Party Banking Library with Web Components and React", German Smolyar

  • 2.
    You are neveralone 🤲 If you need banking features, don’t build a Bank - integrate with it…
  • 3.
  • 4.
    Crafting a Third-Party BankingLibrary with Web Components and React
  • 5.
    Nice to meetyou 🤝 ● Software Engineer at Unit ● Was born in Zhytomyr 󰑒 ● Studied Cyber Security 🔐 ● Former Radio and Wedding host 🎤 ● Moved to Israel 󰏛 in 2017 ● Writing in TS and Scala
  • 6.
    ● Don’t wantto write a lot of code ● No impact on my app ● Minimal documentation reading ● Designer must be satisfied ● Compatible with my framework ● Should be fast Using 󰞦 ● Don’t want to write a lot of code ● No bugs, please ● No client specific features ● Write with favorite framework ● Should work everywhere ● Business needs to serve throw CDN for regulatory issues Building 󰠻
  • 7.
    🧐 Which optionsdo we have? 💡 We can build React, Angular, Vue, Ember... whichever library? 😔 💡 We could use <Iframe>? 😔 💡 Maybe classical way of exposing functions? 😔
  • 8.
    󰠻👍 One morething Web Components
  • 9.
    Key features 🔑 ShadowDOM Encapsulation 󰞲 Custom Elements Way to create new HTML elements 👻 Slots Placeholders 🚮
  • 10.
    󰞲 Custom elements<component> </component>
  • 11.
    🪴 Shadow DOMhelps with DOM pollution
  • 12.
    🪴 Shadow DOMhelps with DOM pollution
  • 13.
  • 14.
    󰠻 Why? ● Widelysupported across all browsers ● Framework-independent ● Declarative ● Encapsulation ● Fail safe (calling an HTML element which doesn’t exist does not cause an error)
  • 15.
    😨 What aboutframework? Lit Stencil React
  • 16.
    “React and WebComponents are built to solve different problems. Web Components provide strong encapsulation for reusable components, while React provides a declarative library that keeps the DOM in sync with your data. The two goals are complementary. As a developer, you are free to use React in your Web Components, or to use Web Components in React, or both.” 🤨 Is it ok to use React?
  • 18.
    But in areal world… We ended up with this 📡 Communication Web Component React Application const ui = function(state) Web Component Web Component Main App Elements Main App Elements
  • 19.
    You can requestto refresh component ⚙ Custom Events
  • 20.
    ⚙ Custom Events Youcan listen to onload
  • 21.
    Reflect on asyncchanges ⚙ Custom Events
  • 22.
    󰞦 Enough of me,how can you use it? Demo
  • 27.
    So each viewis component
  • 28.
    󰠻 Event Bus(sub / pub pattern) To ensure a React component receives events meant specifically for it, we utilize a dedicated event bus for each web component. The event bus has two key functions: eventbus.publish() Receives data and publishes an even encapsulating that data. Internally it creates a new CustomEvent. eventbus.subscribe() Tells the event bus to add an event listener This is the way to get event that WE KNOW was addressed to us.
  • 29.
    📱 Can wedo something for Native (iOS, Android)? Web View Native Experiences
  • 30.
    😬 How canwe achieve it? Card App own UI Component App own UI Component Web view Menu
  • 31.
    🤔 What ifwe change it a bit? Card App own UI Component App own UI Component Web view Card App own UI Component App own UI Component Web view Bottom Sheet Web view { Event }
  • 32.
    󰞦 What's going onhere? Can you prove it?
  • 34.
    💪 How arewe working? Atomic Design Methodology Atoms Molecules Organisms Templates Pages
  • 35.
    🧪 How arewe theming? Global Settings Theming Default Settings Component Setting The @layer CSS at-rule is used to declare a cascade layer and can also be used to define the order of precedence in case of multiple cascade layers.
  • 36.
    🚀 How arewe performing?
  • 37.
    📦 General ● Weuse Storybook for development ● We follow Semantic Versioning. Each version is a new file. ● We keep the right to deploy regulatory changes to existing versions using cherry pick ● We use Cypress for UI tests ● We have security check in CI process ● We deploy preview for each PR
  • 38.
    🎁 Takeaways ● Whilebuilding client libraries, put yourself in junior pants 👖 Always choose best possible interfaces ● Be native and clear in your interfaces ● React is not framework for SPA, it’s just a library as jQuery 💔💀 was ● Everything is possible, don’t work too much
  • 39.