ChickenPaint is an HTML5 port of Marc Schefer's excellent multi-layer drawing Oekaki Java applet ChibiPaint.
ChickenPaint itself is released under GPLv3-or-later, but this example project is released under the WTFPL, so you're free to use this project a basis for your integration.
You can get the sourcecode for this integration here, and the sourcecode for ChickenPaint itself here.