Thin is mostly based on IHP DataSync. You can the source code here https://github.com/digitallyinduced/ihp/blob/master/IHP/Data... Thin itself is just a "thin" wrapper around IHP and IHP DataSync.
Additionally most of the system is just relying on postgres for doing it's work. So if you ever want to swap out Thin with another API, you could build a normal REST API, connect it to the database and switch it out.