Please note that it is not written from scratch and is using a wlroots library that does most of the job. Most of the code are just the handlers for events emitted by the library. You cannot write a Wayland compositor and implement all required interfaces with just 500 lines.