Is there a good place to learn about the structure of **moduli stack** of flat $G$-bundles on an algebraic curve?

Of course, we're just studying representations of a group $\pi_1(X)\to G$ modulo some conjugation (that's why it should be a stack). Since this is very similar to **Galois representations** in number theory, I wonder if there's a reference that also explains the similarities and differences between the two cases.