This is fine, just have a plan before you go into it. Look up a co-ownership agreement contract off LegalZoom, they are like $15, or get a lawyer if you want. Decide if you want to be "Joint tenants" or "Tenants in common". You probably want to be joinjoint tenants so that if one of you dies the property goes to the other person. Go through the agreement, make any changes you want, and then both sign it. These documents outline what happens if someone dies, or if you break up, or if you are allowed to sell your ownership, and anything else.
Keep a record of who has paid what % of equity towards the house. Also look into tax laws, if the mortgage or house is only truly in 1 person's name they may get a tax break that the other person will not get.
The co-ownership agreement is essentially the same agreement that happens when you're married, the only difference is that it happens automatically and implicitly when you're married.
It's interesting that some people are saying this is a horrible idea when it's practically the same as the agreement you'd have if you were married. Whether you're single or married, if you own a house with another person and you break up, it's going to be a bit complicated. Get a contract in place beforehand so that things go as smoothly as possible. If you are both rational adults you shouldn't have any problems.