The early life of stars