Lioo7 / Secrets

This project is a web application that enables users to securely register, log in, and anonymously share secrets, utilizing Node.js, Express, MongoDB, Passport.js, and the Google OAuth 2.0 strategy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Secrets

Node.js Express.js MongoDB Passport.js Google OAuth 2.0 Jest ESLint

Description: This project is a web application built with Node.js and Express that allows users to register, log in, and share secrets anonymously. It follows the MVC architecture, uses MongoDB as the database and implements authentication using Passport.js and the Google OAuth 2.0 strategy.

Table of Contents

Installation

  1. Clone the repository.
  2. Install the required dependencies by running the following command:
npm install
  1. Set up the environment variables by creating a .env file and providing the necessary values.
  2. Start the application by running the following command:
npm start
  1. Access the application in your web browser at http://localhost:3000.

Usage

  1. Register a new account by clicking on the "Register" link on the home page.
  2. Log in with your account credentials or using your Google account.
  3. Share your secrets anonymously by navigating to the "Submit" page and entering your secret.
  4. View secrets shared by other users on the "Secrets" page.
  5. Log out by clicking on the "Logout" button.

Configuration

The application uses environment variables for configuration. Ensure that the following variables are set in the .env file or your hosting environment:

  • PORT: The port number on which the server should listen (default is 3000).
  • SESSION_SECRET: A secret key used to sign the session ID cookie.
  • MONGODB_URI: The URI for the main MongoDB database.
  • TEST_MONGODB_URI: The URI for the test MongoDB database (used exclusively for testing the project).
  • CLIENT_ID: The client ID for Google OAuth 2.0 authentication.
  • CLIENT_SECRET: The client secret for Google OAuth 2.0 authentication.

Routes

  • /: The home page of the application.
  • /auth/google: Initiates the Google OAuth 2.0 authentication flow.
  • /auth/google/secrets: Callback URL for Google OAuth 2.0 authentication.
  • /register: Page for user registration.
  • /login: Page for user login.
  • /logout: Endpoint for user logout.
  • /secrets: Page displaying secrets shared by users.
  • /submit: Page for submitting a new secret.

Running Tests

To run the tests, use the following command:

npm jest

Contributing

Contributions to the project are welcome. To contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive commit messages.
  4. Push your changes to your forked repository.
  5. Submit a pull request describing your changes.

License

This project is licensed under the MIT License.

About

This project is a web application that enables users to securely register, log in, and anonymously share secrets, utilizing Node.js, Express, MongoDB, Passport.js, and the Google OAuth 2.0 strategy.


Languages

Language:JavaScript 75.0%Language:EJS 22.8%Language:CSS 2.1%