The Secrets App is a Node.js application that allows users to securely register, log in, and submit their secrets. The application employs authentication mechanisms, including local and Google OAuth2, and uses PostgreSQL as the database for storing user credentials and secrets.
- User Registration and Login
- Local Authentication using email and password
- Google OAuth2 Authentication
- Secure storage of user secrets
- Ability for authenticated users to submit and view secrets
- Node.js
- Express.js
- PostgreSQL
- Passport.js (Local and Google OAuth2 strategies)
- Bcrypt (for password hashing)
- EJS (for templating)
- dotenv (for environment variable management)
- Express-Session (for session management)
- Body-Parser (for handling request bodies)
- Node.js installed
- PostgreSQL installed and running
- Google Developer account for OAuth2 setup
.env
file with the following environment variables:
SESSION_SECRET=your_session_secret
PG_USER=your_pg_user
PG_HOST=your_pg_host
PG_DATABASE=your_pg_database
PG_PASSWORD=your_pg_password
PG_PORT=your_pg_port
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
- Clone the repository:
git clone (https://github.com/twister904/Secrets.git)
cd secrets-app
- Install the dependencies:
npm install
- Set up the PostgreSQL database:
Create a database and a users table using the following SQL commands:
CREATE DATABASE secretsapp;
\c secretsapp
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
secret TEXT
);
-
Create a
.env
file in the root directory and add the required environment variables. -
Start the server:
npm start
The server will run on http://localhost:3000
.
- Navigate to
http://localhost:3000
to access the home page. - Register a new account or log in with an existing account.
- After logging in, submit your secret on the
/submit
page. - View submitted secrets on the
/secrets
page (only available to authenticated users).
This project is licensed under the MIT License. See the LICENSE file for more details.