Thanks to TypeScript we can abstract this entire logic into a cleanly separated and properly encapsulated application.