# Flat Family of Fibres

I have a question about following argument used in an example in Hartshorne’s “Algebraic Geometry” (see page 259):

We have a surjective morphism $$f: X \to Y$$ between schems where $$X$$ is integral and $$Y$$ a nonsingular curve.

My question is why and how to see that there conditions suffice to see that this family is flat?

I guess that in this context a flat family means just that $$f$$ is flat in each fiber, correct?

Especially I don’t see how the condition that $$f$$ is surjective – a purely set theoretical condition – is used to show this algebraic condition?