This project is a simple authentication system built using MongoDB for data storage and Express.js for handling server-side logic. It provides user registration, login, and logout functionalities.
Check out the live demo here.
- User registration: Users can create an account by providing a unique username and password.
- User login: Registered users can log in using their credentials.
- User logout: Logged-in users can securely log out of their accounts.
- Password hashing: Passwords are securely hashed before being stored in the database for improved security.
- Session management: User sessions are managed using session cookies for authentication.
- User Profile update: Authorized users can update their profile information.
- MongoDB: A NoSQL database used for storing user data.
- Express.js: A web application framework for Node.js used for building the server-side logic.
- Node.js: A JavaScript runtime environment used for executing JavaScript code on the server.
-
Clone the repository:
git clone https://github.com/ESE-MONDAY/authentication-backend -
Install dependencies:
cd authentication npm install -
Set up environment variables:
Create a
.envfile in the root directory and add the following environment variables:PORT=3000 MONGODB_URI=<mongodb-uri> TOKEN_KEY=<whateverkeyyoupick>Replace
<mongodb-uri>with the URI of your MongoDB database and<session-secret>with a random string used for session encryption. -
Start the server:
npm start
- Open your web browser and navigate to
http://localhost:3000. - Register a new account by providing a unique username and password.
- Log in using your credentials.
- Perform authenticated actions such as viewing user-specific content.
- Log out when you're done.
Explore the API endpoints and test the functionality using the Postman collection documentation.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.
Feel free to customize this README template according to your project's specific features, requirements, and preferences.