Coder Social home page Coder Social logo

saba-var / token-based-authentication Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.55 MB

Secure and efficient way to register and authenticate users

Home Page: https://token-based-authentication-demo.vercel.app/

Shell 0.05% HTML 0.27% JavaScript 1.38% TypeScript 97.24% CSS 1.06%
husky react tailwindcss typescript vite cypress react-hook-form react-query storybook eslint axios headlessui i18next redux-toolkit react-toastify router-dom-v6 yup

token-based-authentication's Introduction

Token Based Authentication πŸ”

Token-Based Authentication app offers a secure and efficient way to register and authenticate users. It leverages the power of access and refresh tokens to ensure a seamless user experience and robust security.

Table of Contents

Prerequisites

Tech Stack

Getting Started

1. First of all you need to clone repository from github

HTTPS:

git clone https://github.com/Saba-Var/Token-Based-Authentication.git

SSH:

git clone [email protected]:Saba-Var/Token-Based-Authentication.git

2. Navigate to the repository

cd Token-Based-Authentication

3. Next step requires to install all the dependencies

npm install

4. copy .env.example and create .env file.

cp .env.example .env

5. Run application locally from the terminal:

npm run dev

Open localhost:3000 to view it in your browser.

Testing

In order to run tests you need start development server with the npm run dev command. After that you can run tests with the one of those options:

1. Run E2E tests using the Cypress GUI

npm run cypress:open

2. Run E2E tests in the terminal

npm run cypress:test

Storybook

In order to run Storybook you need to execute the following command in the terminal

npm run storybook

You will be redirected automatically to localhost:6006

Git rules

Semantic Commit types

type Description
feat add new functionality
chore minor changes
fix fix any bugs
refactor the code quality has been improved without changing the functionality
docs improvement/addition of documentation
tests write new tests or refactor the existing ones
wip working in progress

Commit example - chore: rename test workflow

chore: rename test workflow
β”Œβ”€β”€β”€β”€β”€ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      β”‚
β”‚      └──> Commit message in present tense.
β”‚
└─────────> Commit type: chore, docs, feat, fix, etc.

Branches

Branch names are quite the similar to commit types but with different syntax. Example feature branch name fix/password_change_request_redirect_uri

fix/password_change_request_redirect_uri
β”Œβ”€β”€ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   β”‚
β”‚   └─────> Feature branch name written in camel_case
β”‚
└─────────> Feature branch type

Setting up Eslint & Prettier

Visual Studio Code

1. You need to install following extensions in VS Code Prettier - Code formatter and ESLint

WebStorm

1. open settings Ctrl + comma

2. search for Prettier and then select on save. Don't forget to choose Prettier package

3. search for Eslint and make sure it is not disabled

4. go to Keymap and search Eslint

5. change the shortcut of FixEslintProblems

Project Structure

β”Œβ”€β”€β”€ .github
β”‚     └── workflows
β”œβ”€β”€β”€ .husky
β”œβ”€β”€β”€ .storybook
β”œβ”€β”€β”€ cypress
β”‚    β”œβ”€β”€ e2e
β”‚    β”œβ”€β”€ fixtures
β”‚    └── support
β”œβ”€β”€β”€ publicΒ 
β”‚    └── assets
β”‚        └── locales
β”‚            β”œβ”€β”€ en
β”‚            └── ka
β”œβ”€β”€β”€ readme
β”‚    └── assets
β”œβ”€β”€β”€ src
β”‚    β”œβ”€β”€ assets
β”‚    β”‚   └── images
β”‚    β”œβ”€β”€ components
β”‚    β”‚   β”œβ”€β”€ icons
β”‚    β”‚   β”œβ”€β”€ layout
β”‚    β”‚   β”œβ”€β”€ shared
β”‚    β”‚   └── storybook
β”‚    β”œβ”€β”€ config
β”‚    β”œβ”€β”€ data
β”‚    β”œβ”€β”€ hooks
β”‚    β”œβ”€β”€ pages
β”‚    β”‚   β”œβ”€β”€ 404
β”‚    β”‚   β”œβ”€β”€ account-activation
β”‚    β”‚   β”œβ”€β”€ home
β”‚    β”‚   β”œβ”€β”€ log-in
β”‚    β”‚   β”œβ”€β”€ new-password
β”‚    β”‚   β”œβ”€β”€ profile
β”‚    β”‚   β”œβ”€β”€ request-password-reset
β”‚    β”‚   └── sign-up
β”‚    β”œβ”€β”€ router
β”‚    β”œβ”€β”€ services
β”‚    β”œβ”€β”€ store
β”‚    β”‚   β”œβ”€β”€ slices
β”‚    β”‚   └── store.ts
β”‚    β”œβ”€β”€ types
β”‚    β”œβ”€β”€ utils
β”‚    β”œβ”€β”€ validation
β”‚    β”œβ”€β”€ env.d.ts
β”‚    β”œβ”€β”€ index.css
β”‚    └── main.tsx
│── .env
│── .env.example
│── .eslintrc
│── .gitignore
│── .prettierrc
│── cypress.config.ts
│── i18n.ts
│── index.html
│── package-lock.json
│── package.json
│── postcss.config.js
│── README.md
│── tailwind.config.js
│── tsconfig.json
│── tsconfig.node.json
│── vercel.json
└── vite.config.ts

Live URIs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.