First create an engine, for example with name 'cms'.
$ rails plugin new cms --mountable
This command will create full file tree for your engine.
Use manual and some extra tips from below - https://github.com/plataformatec/devise/wiki/How-To:-Use-devise-inside-a-mountable-engine.
Steps and tips: