For the transfer switch, you can use either a single-pole double throw motor rated switch for a 120V like a Leviton 1285, or a double-pole double throw motor rated switch like a Leviton 1288 for 240V. It must be motor rated.
You’ll also need a power inlet and a cord that connects between your generator and the inlet. Please buy a premade cable and the proper inlet, do not hack together a cord with two male ends aka a suicide cable that you plug into a standard outlet. Example of a safe setup: https://www.vevor.com/power-outlet-box-c_12116/vevor-30-amp-...
Wire the generator inlet to one side of the switch and connect the other side of switch to the utility fed circuit.
Label the switch positions so you don’t forget.
When the power goes out, flip your switch to the generator side, connect your generator to the inlet and turn it on. When the power comes back, flip the switch back to utility and turn off the generator. The center position of the switch is off and it’s impossible to backfeed the utility under normal conditions.