I am pretty familiar with Arduino, and I will be using a NodeMCU for an upcoming project I'm doing. I have never used a NodeMCU before. I am using it along with a few sensors to turn on and off some 12v DC Solenoid valves to water my garden. Anyways, I was trying to figure out how to control the solenoid valves with the NodeMCU, as I am more familiar with 5v than the 3.3v from the NodeMCU. I was planning on using a MOSFET, but I can't find any other NodeMCU projects that use MOSFETs. They seem to all use those relay boards. What is a good MOSFET for this purpose? The solenoid only draws less than an amp, but im planning on using this mosfet for a go to for other projects in the future, so maybe somewhere in the 3-6A range. The most important thing is working with the 3.3v from the NodeMCU. And can I just connect the base of the MOSFET directly to the NodeMCU pin or do I need a resistor?
If you ask 10 people here, you will probably get 10 different answers.
This is what I use as a hobbyist. The TO-220 package is friendly for home use. Low ON resistance is more important than maximum current. You want to oversize for low voltage drop and so you won't need a heatsink for most use. This part is rated at 60A, but I wouldn't use it at more than 10A or so with a 3.3V gate drive.
If you are building a ton of these, you might want to look for something lower cost. Learn to understand the curve that specifies voltage drop vs current for various gate voltages.
For a simple switch you generally don't need a series gate resistor. But you probably do want a resistor to ground. Otherwise, if your MCU isn't initialized before 12V is applied, you may drift into a linear region and stress the MOSFET.
Adding to the answer of @Mattman944, and answering your question about gate resistance:
Series Gate resistance: Unless you are going to switch on and off several times, as it is the case of SMPSs, the gate resistance should not be necessary. I can think of two reasons which could require a gate resistance: a) in a SMPS, it can be used to slow down the dI/dt of the MOSFET, thus reducing EMC problems. b) in old technologies, the MOSFET's gate capacitance was prone to be destroyed if the inrush current was not limited.
Because of the highly inductive load, make sure to decouple (via capacitors) the supply voltage of the NodeMCU and the one from the solenoid, in order to prevent interference and voltage drops of their voltage supplies. In some cases it can even shut down the MCU.