1-install fastboot and adb drivers
2-bootloader unlock (mi unlock for mi phone)
3-get twrp recovery img,a custom rom zip,magisk (
https://github.com/topjohnwu/Magisk/releases) and gapps if not in rom (
opengapps.org or
nikgapps.com)
4-move twrp in adb's location
5-open adb and connect phone
6-get adb drivers
7-type "adb reboot bootloader"
8-type "fastboot flash recovery (twrp name).img"
9-once done,type "fastboot boot (twrp name).img"
10-once you are in twrp,swipe to allow modification
11-goto wipe select andvanced and check vendor,dalvik,cache,data, system
12-go back on main menu
13-on pc,transfer magisk and rom if phone doesn't show type "adb push (file path) /sdcard"
14-go to install in twrp and select custom rom zip and swipe
15-(if not in rom) install gapps
18-install magisk
17-flash the boot.img to boot part from.recovery
18-reboot
doned.