<aside> đŸ§‘â€đŸ’» This documentation is part of the Technical Kick-start Collection. If you’re a developer interested in contributing to Thea, or just looking to understand how Thea works on a deeper level, then I’d highly recommend reading through this collection.

</aside>

Code Architecture


Thea’s back end, written in Go, is responsible for essentially every aspect of Thea - in that sense, the front end is functioning as a ‘thin client’, containing no real functionality or logic aside from presentation-logic.

Thea consists of three main layers:

Inter-Service Communication


Thea services should try to avoid calling in to each other as much as possible. If some logic needs access to data from multiple services, then it’s positioning inside a service should be re-considered; Thea core is likely a better place for it to live.

However, Thea services often needs to be aware of outside changes by way of communication; Thea’s solution to this is a centralized event bus that services can use to both emit and subscribe to events. The events a particular service emits/subscribes to are documented in each service.

Event Etiquette

Events should not contain data structures, rather opting to use the id of the data that exists in some persistent data store. If you find yourself needing to share data between two services, then reconsider whether:

Most of the time, needing to share data itself is a sign that your inter-service communication is flawed - typically due to one service doing too much. A good way to detect this is to look out for branching flows in your service code; different behavior depending on the external state is often a sign that the service is trying to handle too many states.