Skip to content
/ notek Public

NOTEK: A Web App for Note Taking πŸ“

Notifications You must be signed in to change notification settings

Emmraan/notek

Repository files navigation

NOTEK: A Web App for Note Taking πŸ“

BUILD WITH: MEEN ==> MongoDB: πŸƒ, Express: πŸš‚, EJS: πŸ“„, Node.js: 🟒

Technology Description Logo
MongoDB NoSQL database for storing data. MongoDB
Express Web application framework for Node.js. Express
EJS Simple templating language that lets you generate HTML markup with plain JavaScript. EJS
Node.js JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js

Features

Category Feature Icon
CRUD Operations Create ✨
Read πŸ“–
Update πŸ”„
Delete πŸ—‘οΈ
Styling Tailwind CSS 🎨
Responsive Design πŸ“±
Authentication Login πŸ”‘
Signup ✍️
Single Sign On (SSO) πŸ”‘
Email Verification πŸ“§
Many Checks During Signup and login βœ…
Security Protect Website from Disposable Email πŸš«βœ‰οΈ
Protect from (CSRF) Attack πŸ›‘οΈ
Rate Limiting ⏳
New Login Verification 🌐
Notes and password are Encrypted in Database πŸƒ
Account Recovery Reset Password
Change Email

SOME PREVIEWS πŸ‘οΈ

HomeLogOut πŸšͺ

HomelogOut

Home Login Blank πŸ”²

HomelogOut

Home Login πŸ”‘ With Note πŸ“

HomelogOut


Running the Project Locally

To run this project on your local system, setup few things before cloning the repo!:

First, go to the Gmail Account Security Settings In the search bar, type "app password" and follow the instructions to create an app password for your Gmail account then copy password and save it, This will be used for email verification.

App Password look Like:

appPass

Note: 2-Step verification must be enabled on your Gmail account; otherwise, you will not be able to create an app password.


Database Connection

To set up the database connection, follow these steps:

1. Go to MongoDB Cloud. If you do not have an account, create one.

2. Create a database cluster, For tutorial simply search or Click Here

3. Copy the MONGODB_URI and save it. This will be used to store our user information.


Single Sign On (SSO) Setup:

  • Google: To get GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET got to Google Cloud and create OAuth Credentials, For tutorial simply search or Click Here

  • Github: To get GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET got to GIthub Developer Settings and create OAuth Credentials, For tutorial simply search or Click Here

  • Microsoft: To get MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET got to Azure App Registrations and create OAuth Credentials, For tutorial simply search or Click Here

  • Discord: To get DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRET got to Discord Developer and create OAuth Credentials, For tutorial simply search or Click Here


Installation πŸ› οΈ

  1. Clone this repository to your local machine.
git clone https://github.com/Emmraan/notek.git
  1. Navigate to the project directory.
cd  notek
  1. Install dependencies using npm:
npm install

Setting Up Environment Variables

  1. Follow these steps to set up your environment variables:

  2. Create a new .env file in the root directory of this project.

  3. Copy the variables from .env.example and paste them into the new .env file.

  4. Replace the placeholder values with your own.

In the .env file, use the following format:


## Replace the username password and Database name.

1. MONGO_URI="mongodb+srv://<username>:<password>@cluster0.4m7l6.mongodb.net/<yourDBname>?retryWrites=true&w=majority&appName=Cluster0"

## Generate or create a long hex secret for JWT_SECRET, SESSION_SECRET and NOTE_SECRET e.g., 7f45d1f47ebf4e1af1e148cd00fe97e5472df8e5b5c8e8af

2. JWT_SECRET=your_jwt_seceret_here

3. PORT=3000

4. USER= <here your email>

5. PASS= <here your app password>

## This domain is attached before email_verify route!
## For development purposes, use: http://localhost:3000

6. DOMAIN= <here your domain>

## session secrect same like jwt secrect

7. SESSION_SECRET=your_session_seceret_here

## NOTE secrect same like jwt and session secrect but make sure the length of NOTE_SECRET is 32 .

8. NOTE_SECRET=your_session_seceret_here

9.GOOGLE_CLIENT_ID=<here your GOOGLE_CLIENT_ID>
10.GOOGLE_CLIENT_SECRET=<here your GOOGLE_CLIENT_SECRET>

11.GITHUB_CLIENT_ID=<here your GITHUB_CLIENT_ID>
12.GITHUB_CLIENT_SECRET=<here your GITHUB_CLIENT_SECRET>

13.MICROSOFT_CLIENT_ID=<here your MICROSOFT_CLIENT_ID>
14.MICROSOFT_CLIENT_SECRET=<here your MICROSOFT_CLIENT_SECRET>

15.DISCORD_CLIENT_ID=<here your DISCORD_CLIENT_ID>
16.DISCORD_CLIENT_SECRET=<here your DISCORD_CLIENT_SECRET>

To start the development server, run the following command:

npm run dev

Server Auto-Restart with Nodemon πŸ”„

Accessing the Server On 🌐 http://localhost:300


Want to run it in a Docker container?

Note: Make sure .env file is setup in your root directory before build the docker image, and DOCKER installed in your system!

Build Docker image

# Build the app
docker build -t your-image-name .

# Run Docker container for development
docker run -d -p 3000:3000 --name your-container-name your-image-name

# Now for Run the container without `TypeError: OAuth2Strategy requires a clientID option` error we have required to copy .env file in docker container
docker cp `/path/your/.env/file` <container-name>:/app/.env
or
docker cp `/path/your/.env/file` <container-id>:/app/.env

## Now Restart The Container
docker restart <your-container-name> or <your-container_id>

# To stop the container
docker stop your-container-name

# To remove the container
docker rm your-container-name

# To remove the image
docker rmi your-image-name

Accessing the Container On 🌐 http://localhost:3000

OR

Run Docker Image Without Build It:

Note: Make sure .env file is setup in your system before Running the docker image, and DOCKER installed in your system!

Pull the latest version of the notek image

docker pull emmraan/notek:latest

OR

Pull a specific version of the notek image

docker pull emmraan/notek:`<version>`  (e.g., 2.2.2)

Run Docker container

docker run -d -p 3000:3000 --name `your-container-name` emmraan/notek

Now for Run the container without TypeError: OAuth2Strategy requires a clientID option error we have required to copy .env file in docker container

docker cp `/path/your/.env/file` <container-name>:/app/.env
or
docker cp `/path/your/.env/file` <container-id>:/app/.env

Now Restart The Container:

docker restart <your-container-name> or <your-container_id>

Accessing the Container On 🌐 http://localhost:3000

To stop the container

docker stop your-container-name or your-container_id

To remove the container

docker rm your-container-name or your-container_id

To remove the image

docker rmi emmraan/notek or image_id

Or, to remove a specific version of the image

docker rmi emmraan/notek:<version> (e.g., 2.2.2) or image_id

🌟 Contributing to Notek?

First off, thanks for taking the time to contribute! πŸŽ‰

How Can I Contribute? πŸ€”

πŸ› Reporting Bugs

If you find a bug in the project, please open an issue by following the bug report template. Provide as much detail as possible to help us resolve the issue quickly.

🌟 Suggesting Features

We welcome feature requests! Please follow the feature request template to suggest new features. Be sure to provide enough context and details.

πŸ”„ Pull Requests

We love pull requests from everyone. Here’s a quick guide to help you get started:

  1. 🍴 Fork the repository.
  2. 🌿 Create a branch: git checkout -b my-feature-branch.
  3. πŸ› οΈ Make your changes.
  4. βœ… Commit your changes: git commit -m 'Add new feature'.
  5. πŸš€ Push to the branch: git push origin my-feature-branch.
  6. πŸ“₯ Open a pull request.

Please ensure your pull request adheres to the pull request template.

πŸ–₯️ Code Style

  • Follow the existing code style and structure.
  • Write meaningful commit messages.
  • Add comments to your code where necessary.

🀝 Code of Conduct

This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.