only just
Synonym discussion
Sense: idiom/2
'Only just' emphasises a narrow margin with a slight tone of relief or luck: the outcome happened, but it was very close. 'Barely' is the closest synonym and is more neutral — it simply states the narrowness without the emotional flavour. 'Hardly' is stronger and leans towards 'almost not at all' — saying 'I can hardly hear you' suggests you hear almost nothing, while 'I can only just hear you' suggests you do hear, but with difficulty. 'Scarcely' is the most formal of the four and appears more often in writing than in conversation. For example: 'We only just caught the train (we got on as the doors closed)' vs. 'We barely caught the train (neutral fact)' vs. 'There was hardly anyone on the platform (very few people — a different nuance).'
Etymology
The phrase 'only just' combines two words from different historical roots. 'Only' comes from Old English 'ānlic' meaning 'one-like, unique, solitary'. 'Just' entered English via Old French from Latin 'jūstus' meaning 'righteous, fair, exact'. The phrase came into common use in Middle English to express two related ideas: precise timing (sense 1) and a narrow margin (sense 2). Both senses developed naturally from the core idea of 'exactly' and 'no more than'.