This project is a secure backend application built for user authentication using Node.js, Express.js, and PostgreSQL. User passwords are stored using bcrypt, a secure hashing algorithm that incorporates salting to protect against password cracking attempts. With its emphasis on security and robust authentication mechanisms, this project provides a solid foundation for building secure web applications.
- User Registration: Users can sign up with a unique email address and password.
- User Authentication: Passwords are securely hashed using bcrypt. Authentication is implemented using Passport.js with a local strategy for email/password authentication and Google OAuth2 strategy for Google authentication.
- Session Management: Sessions are managed using express-session with session data stored in the PostgreSQL database.
- User Interface: The front-end interface is built using HTML, CSS, and EJS templates.
Demo.mp4
-
Clone the repository: git clone https://github.com/Muntajir11/SignUp.git
-
Install dependencies: --> cd SignUp [Go to the folder where it was cloned] --> npm install
-
Set up environment variables:
Create a .env
file in the project root directory and add the following environment variables:
PG_USER=your_postgres_username
PG_PASSWORD=your_postgres_password
PG_DATABASE=your_database_name
PG_HOST=your_postgres_host
PG_PORT=your_postgres_port
SESSION_SECRET=your_session_secret
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
Replace your_postgres_username
, your_postgres_password
, your_database_name
, your_postgres_host
, your_postgres_port
with your PostgreSQL database credentials, and your_session_secret
, your_google_client_id
, your_google_client_secret
with your own secret keys.
- Create PostgreSQL Database:
You need to create a PostgreSQL database with the provided credentials. Refer to the PostgreSQL documentation for instructions on creating a database.
- Run the application: node index.js
- The application will be running on http://localhost:3000 by default.
- Open your web browser and go to http://localhost:3000.
- Sign up for a new account or log in with existing credentials.
- After successful authentication, you will be redirected to the welcome page.
- Click on the "Logout" button to log out of the application.
Contributions are welcome! If you find any bugs or want to suggest new features, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.