its a ####load of chips, resistors, caps, diodes, etc. dirtboxes are the simplest generally speaking. You will have little luck building a modulation into a guitar, since the boards are pretty big. for those, your best bet is buying some smd board meant for guitar installation
for instance, a tubescreamer is a dual opamp, some caps/resistors and two diodes. the dual opamp is a single chip which in this application makes two seperate boosters which work together. the caps/resistors provide filtering of the signal, and generally make it work. the diodes are where the distortion comes from. at a certain voltage level, they 'turn on', and allow signal to pass through. In dirtboxes, this means that when the input level is high enough, they 'turn on' and pass the signal to ground, so that it literally cuts off the soundwave of the guitar. this is the basic formula for most dirtboxes. a fuzz face is a different story, which uses two cleverly placed jfets, which function as boosters, driving each other for the fuzzy goodness. Basically, dirtboxes are simple, modulations and delays are mind####s.
the reason active circuits are used for dirtboxes is that if you simply used diodes to ground, you would lose signal, as well as not being able to drive them as hard as you could with a booster. This doesn't mean you cant stick one in your guitar however, and it would be pretty much as easy as a tone circuit or the like. The fun comes with switches/pots. You could make it an octaver, adjust headroom and/or compression (seperately), make it cut out the middle of the wave, not the ends (as seen in both the ZVEX machine and some boss pedal... the metalzone or something. thats where that sneaky #### stole it from, but he lies about it. i digress...), make it cut highs when it distorts, make it boost highs when it distorts, or all of the above. you make me sad im swamped with projects 😢😢😢 i will make this beast one day though, have no doubt.
by the way, you could also build a booster into your guitar + add a switch for dirt rather easily. ill refer you to some sites/schematics if youre interested.
edit: forgot to mention, the reason there are two diodes rather than one is that diodes only work in one direction; theyre meant for dc signal. however, guitar signal is ac, so putting them in opposite, and parralell corrects this mistake. if you dont do this, it chops off half of the wavelength, making an octave effect which is awesome anyway.