https://github.com/njorogemaurice/node-react-jwt
This is a project to create a JWT authentication using Node js(backend) and React js(frontend).
https://github.com/njorogemaurice/node-react-jwt
jwt nodejs reactjs
Last synced: 3 months ago
JSON representation
This is a project to create a JWT authentication using Node js(backend) and React js(frontend).
- Host: GitHub
- URL: https://github.com/njorogemaurice/node-react-jwt
- Owner: NjorogeMaurice
- Created: 2024-02-27T09:11:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T07:07:13.000Z (over 2 years ago)
- Last Synced: 2025-04-05T12:44:11.023Z (about 1 year ago)
- Topics: jwt, nodejs, reactjs
- Language: JavaScript
- Homepage:
- Size: 222 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node-React-JWT
This is a project to create a JWT authentication using Node js(backend) and React js(frontend).
## Table of Contents
- [Prerequisite](#prerequisite)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
## Prerequisite
To run Node-React-JWT you need to have node installed on your computer. To install node follow the instructions [here](https://nodejs.org/en/download/).
## Installation
To get started with the Node-React-JWT project, follow these installation steps:
1. Go to the directory where you want to create your project and clone the repo:
```bash
git clone https://github.com/NjorogeMaurice/Node-React-JWT.git
```
2. Change into the project directory:
```bash
cd Node-React-JWT
```
3. Install all the dependencies for Nodejs (backend) using npm:
```bash
npm install
```
4. Change into the frontend directory:
```bash
cd frontend
```
5. Install all the dependencies for Reactjs (frontend) using npm:
```bash
npm install
```
## Usage
5. Create a .env file in the root directory of your project. Add the following to it:
```bash
PORT = 5000
JWT_SECRET_KEY = 'your secret key'(use comand "openssl rand -hex 32 or 64" to generate the random key)
TOKEN_HEADER_KEY = 'your secret key'(use comand "openssl rand -hex 32 or 64" to generate the random key)
SQL_DB_NAME=''
SQL_USER_NAME=''
SQL_USER_PASSWORD=''
SQL_DB_HOST=''
SQL_DB_DIALECT='mysql'
```
5. After that you can run the backend on your local machine:
```bash
node main.js
```
## Running Reactjs(Frontend)
Change to the frontend directory
```bash
cd frontend
```
Then run the following command:
```
npm start
```
Happy Coding!