+1 on a spare gun. If you really need it to work, like for classes when downtime is serious loss of value, bring another similar-enough gun. Only time I didn't do that I had like 30 people who knew me attending, who lived closer so brought their spare carbines so would (pre-arranged) borrow one. Similar issues for things like upgrading, deep cleaning, etc. You can take one apart, still have a running gun.
+1000 on magazines. You will have mag failures (broken, bad followers, worn springs) much faster than a broken gun if they aren't on your maintenance schedule.
I keep no explicit spare parts, just keep all (good) spares I have taken off for updating, etc.
I do keep a handful of spare recoil springs, so if I suspect that or notice it's too short on a cleaning, I just toss it, get a new one.
If worried still, I'd not over-think the specifics and get a "spare parts kit" (as mentioned already) from any reasonably reputable maker. One of those that comes bagged like an LPK, ready to use. Make sure it has all the tedious pins: a replacement extractor with no pin is begging for the pin to be lost during install.
There are pistol grip storage inserts with spare parts storage, like a bolt. I never got that. It's a fair bit of effort to take apart the whole gun, unlikely to be done with only my gun on me, so even if I was on some save-the-world expedition I'd carry spares in the pack or just assume casualties and pick up a spare gun