Pretty much everone has asked themselves this question at some point in their live.
I too did so multiple times and I’ve gone the existantialist way – believing that there is no such thing as a universal meaning in life but rather that oneself has to give meaning to it.
Contrary to absurdism I don’t think that meaning of life is gone once you’re dead – I believe that your life can and has meaning after you died for the things you’ve done that others benefit or learn from.
This is a good example: I am creating a website (or at least the HTML document) that hopefully will remain after my death so that whoever sees this can understand who I was, what I did and how I felt about certain things. This gives meaning to my life even after I’m dead because with this I feel like I’m providing information about me and my life and my time that I wish I had from my ancestors.