Before you start coding, consider how you want the site to work. If you want to authenticate from a database, for instance so that users can pick their their own user ID and change passwords you will need to do some coding.
Using .htaccess and .htpasswd files should work without doing any separate coding IF you are willing to edit them yourself. Just make sure that the script is in a directory or a directory underneath the one containing .htaccess and that your web host will handle .htaccess files. Some hosts restrict where you can store script files as well.