In this answer of Martin Brandenburg he refers to the universal properties of the open and closed immersion. As this looks kind of useful I tried to find a reference but I couldn't find any. So my question is
Is there a way to see an open immersion and a closed immersion (and perhaps general immersion) of schemes as a solution to a universal problem?