There are a million options for authentication already created and ready for use. Nearly every CMS has this ready for you on install. You could also go with active directory. You could also use the major ones that integrate with Google, fb, etc. Starting from scratch is fine but you'll have to use a ton of development time that could be better spent on your app.