This is a demonstration of Office 365 Patterns and Practices code, which shows how to provide document library template capability using app model techniques.
- Provide UI where end users can request new libraries
- Create libraries and lists using app model techniques with additional settings
- Associate content types to newly created libraries based on customer actions
Actual code and additional details can be found from following address - https://github.com/OfficeDev/PnP/tree/master/Scenarios/ECM.DocumentLibraries