The life of stars and their planets