Well I made a generic boardgame library years ago when I was still in uni…
It has all the components you mention, I didnt implement chess using it, but a variant called Quinta (which is actually a pretty cool game)… It’s kinda like chess, but smaller (board size and less pieces), but has some additional fancy rules which make it quite interesting.
To implement chess using the lib you’d only need to implement the chess gamerules, the rest is taken care of. Unfortunatly I only have a WIP version where I was optimizing the AI algorithm (alpha/beta search) further, but never got around finishing that (but shouldnt be too hard to finish). Also all code comments are in Dutch as I was writing it for school.
Still if you’re interested let me know, and I’ll see what I can polish up and put it online…