I made an engine on top of PICO-8. With fairly minor changes it ought to be usable for other games. I put a few notes about how to start doing so on the GitHub page at https://github.com/Feneric/Minima
Note though that the limits in PICO-8 are pretty fierce and the production version of the code had to be made a little ugly in order to fit within them. It's probably easier learning the structure from an early version before looking at the production one.