This project is a basic signin/signup website template built using Node.js, Express, EJS, and MongoDB. It provides a simple user authentication system with integrated JSON Web Tokens (JWT) for session management. This template can be used as a starting point for building user authentication features in your own projects.
• User signup and login functionality.
• Password encryption using bcrypt.
• Session management with JSON Web Tokens (JWT).
• Integration with MongoDB for data storage.
Prerequisites
• Node.js installed on your machine.
• MongoDB installed and running locally or a MongoDB Atlas account for cloud-based database storage.
Initialization
- Clone the repository
git clone <repository-url>- Install dependencies
npm install- Set environment variables
• Create a .env file in the root directory.
• Add the following environment variables:
MONGO_URI=<your-mongodb-uri>
SECRET_KEY=<your-secret-key>Replace with the URI of your MongoDB database, and with a secret key for JWT encryption.
- Start the server
npm start
OR
nodemon server.jsOpen your web browser and navigate to http://localhost:4000 to access the signin/signup website.