Prim and precise order.
The origin of this phrase is still doubtful. Some suggest cap-à-pie, like a knight in complete armour. Some tell us that apples made into a pie are quartered and methodically arranged when the cores have been taken out. Perhaps the suggestion made above of nap-pe-pli (French, nappes pliées, folded linen, neat as folded linen, Latin, plico, to fold) is nearer the mark.
It has also been suggested that “Apple-pie order” may be a corruption of alpha, beta, meaning as orderly as the letters of the alphabet.
“Everything being in apple-pie order, ... Dr. Johnson ... proposed that we should accompany him ... to M'Tassa's kraal.” —Adventures in Mashonaland, p. 294 (1803).
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894