The three basic building blocks are NAND, NOR and NOT gates.
You can build any logic gate you want from 2 input NAND or NOR gates. e.g. A NOT gate is a NAND gate with the two inputs connected together. An OR gate is a NAND gate with NOT gates on both inputs.
When it comes to building them just about all digital logic is these days is made of CMOS FET transistors. A NOT gate takes two transistors, a NAND gate or a NOR gate takes 4 transistors e.g. a NOR gate looks like this.
simulate this circuit – Schematic created using CircuitLab
For a NOT remove M2 and M4, for a NAND put M3 and M4 in parallel and M1 and M2 in series.
There are some optimizations you can do for more complex structures but hopefully you can see how by using these building blocks you can make any logic gates or function you want.