Advice on relay box - MDF?

Hi,
I plan to make a 4 channel relay + nodemcu (like the sonoff) and was wondering if I can house them in a box made of MDF wood?

MDF is easy to work with and I can make to my custom size.

Would it be ok to install the box behind the mains panel connected to the mains line/switches, in terms of fire safety?

Thanks

Temerity:
Would it be ok to install the box behind the mains panel connected to the mains line/switches, in terms of fire safety?

That raises a lot of questions and I suspect people here are unlikely to be qualified to answer them.

Wherever you live there are likely to be official fire safety requirements. A local qualified electrician would probably be the best person to advise.

He will need to consider the location, the arrangement of existing wiring and its relationship to the new parts as well as the way the relays are installed and the risk of them causing a fire.

When fire is a risk a steel enclosure would probably be a good idea. They are readily available from electrical suppliers.

...R

simple answer is no.

Once you touch mains power, all electrical codes, both local and national come into play.
If a fire occurs, and the cause can be pointed at this device, the insurance can deny coverage.

A good rule of thumb is that if you do not know the regulations and codes, you should not be doing that work.
Here in the USA. voltages like 24 volts and under do not require the devices be regulated the same as mains voltages.

There is a requirement here in the USA that you are not allowed to have low voltages and mains voltages in the same enclosure. That means that the mains portion has to be isolated from the low voltage portion by a physical barrier.
And any device or wire, that is in the mains side, must be rated for higher than the expected voltages.
so, if have 230 VAC, the wire and the device have to be rated for use higher than 230VAC. no hobby wires allowed.

It would be highly recommended that you enclose your project in some sort of enclosure that has is certified by your codes. These can be found in most hardware stores and are not expensive. The great thing is that they have standard hole placement and you can get covers cheap.

As a rule, there are so many devices that are rated/certified that can take your low voltage and control mains voltages that there is no need to try to use hobby level parts on the mains side.