Back in 2011 I wrote how a Third World country could set up armed forces / national policing forces without wasteful spending, with a low probability of a coup and with systemic bias against corruption of the lower ranks.
This time I will present a possible configuration for a Republican Third World country that has more (but not much more) need for actual military forces capable of conventional warfare and wants to emphasize coup-proofing. Dictatorships and republics alike often produce very poor military forces in the Third World and even in Europe if they insist on proofing against a coup d'état. This is usually done by choosing senior officers based on loyalty first, with competence a distant second at best. This produces very sluggish and generally poorly trained military forces incapable of much mobile warfare and very brittle even in static deliberate defence (as seen once again when the Iraqi army was attacked by daesh, for example).
My central idea is to insist on competence (or potential for future competence of the officer) first, but to proof the government against a coup d'état with three critical measures:
(1) keep the army small
(2) keep the army garrisons far from the capital
(3) protect the capital with a coup-proofed militia
(1) limits how badly the country may be threatened; hence the "(but not much more) need for actual military forces" mentioned above.
(2) is both a function of actual distance and of deployability. You wouldn't want to set up a very road-mobile brigade with all-wheeled AFVs, but rather choose a mechanised brigade with tracked AFVs, with very few tank hauling trucks at the brigade's garrison
(3) is why this is for a republic only, and the coup-proofing of the militia could be achieved by keeping it demobilised most of the time and avoiding high level commands; a bunch of battalions under direct control of the politicians would be suitable.
An example would be Libya during the 1970's. The historical path included a small loyal yet hardly competent army, and an oversized air force (largely directed against Israel). There were no real threats of invasion by Tunisia, Algeria or Egypt though, so in addition to about 10,000 paramilitary forces for border/airport/harbour/maritime security and customs there could have been a mechanised brigade or division (with little infantry strength) garrisoned at Derna in the Northwest and a 30,000+ militia at the capital of Tripolis in the Northwest of the country. This would have been largely coup-proofed.
There would have been the seeds for a real navy (paramilitary coast guard), air force (border guard's border patrol aircraft) and large army (the mechanised brigade or division) for a 5-10 years expansion into a military powerhouse, but the annual expenses and the risk of a military coup d'état would have been small. Well, assuming there was a republic, which wasn't. So this is more of a geographic example. By the time the mechanised infantry-weak mechanised coup forces had arrived at Tripolis, the militia would have been mobilised and made combat-ready. This would have been a huge deterrent against a coup attempt.
This example also shows that this concept really only protects the top of the government at the capital - it would not protect against a secessionist movement supported by the army. That case could be warded against by introducing a small loyalty (minority or regional background) criterion for senior officer selection and promotion, though. You'd only need to mix the (whole) officer corps properly to prevent a desertion of the army to a secessionist cause.