Skip to content

NemoZon/jwt-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JWT Authentication Example

This repository contains a JWT authentication example with both client-side and server-side setup. The project uses MongoDB for data storage and Gmail for email verification.

Getting Started

Follow these steps to get the project up and running on your local machine.

Prerequisites

Ensure you have Node.js installed on your computer.

Clone the Repository

To clone the repository and access the project folder, run the following commands:

  git clone https://github.com/NemoZon/jwt-auth.git

Server Setup

Install dependencies for a server side

Navigate to the server directory and install the necessary dependencies:

  cd ./server
  npm install

Environment Configuration

Create a local environment file for server configuration:

  node --eval "fs.writeFileSync('.env.local','')"

Edit the .env.local file by copying the contents from .env and updating the necessary values.

MongoDB Setup

  1. Create a MongoDB cluster by signing up or logging into MongoDB.

  2. Obtain your MongoDB connection string (format: mongodb+srv://...) and add it to the .env.local file as DB_URL.

Email Configuration

To use Gmail as the SMTP service for sending email validations:

  1. Replace SMTP_USER with your Gmail address.

  2. Replace SMTP_PASSWORD with your app password.

Run the Server

Start the server using:

  npm run dev

Client Setup

Install Client Dependencies

Navigate to the client directory and install the necessary dependencies:

  cd ./client
  npm i

Run the Client

Start the client application:

  npm start

Access the Application

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published