A minimal example on how to have customizable keymaps in the preferences of your Blender addon
I recommend following this folder/file structure for any addon, no matter how small.
This makes expanding the addon or merging functionality together much easier.
In case you want more details, I can't recommend ST3's addon development course enough. https://blendermarket.com/products/st3-blender-addon-course
for their keymap preferences drawing method found here:
https://blenderartists.org/t/keymap-for-addons/685544/6
https://github.com/kilbee/kbPIEs/blob/e7070e591d157aabfeb554366c317c1cf121b4bf/kbPIEs.py#L36
This repository/addon is a slightly more refined and cut down version of their method.
for their in depth reference on Keymap Names, Region/Map/Space and Key Types, etc.
Check out their Github! https://github.com/brybalicious
for (among many things) helping figure out how to get customized keymaps to stay between restarts.
Check out their site! https://proxe.io/
For their wonderful BPY course for beginners
The folder structure of this addon is heavily based on their work, so be sure to check them out!
BPY Course: https://blendermarket.com/products/st3-blender-addon-course
Their Gumroad: https://st3.gumroad.com/