Skip to content

MERN Stack Authentication using Sequelize (MySQL as dialect) for backend template.

Notifications You must be signed in to change notification settings

PROTEK-ID/mern-auth-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mern-auth-template

MERN Stack Authentication using Sequelize (MySQL as dialect) for backend template.

setup

create .env file in root project or in server (recommended in root because hosting provider sometimes need to put in root directory), and create these variables:

DB_HOST = localhost
DB_PORT = 3306
DB_USERNAME = root
# leave empty if dont need password
DB_PASSWORD = 
DB_DATABASE_NAME = my_database

ACCESS_TOKEN_SECRET = random-string
REFRESH_TOKEN_SECRET = different-random-string

the value could be vary depending on your local database setup and also the dialect could be vary. dont forget to create my_database in your database first or change it to other name that exist.

installation

only need to run this for installing both client and server.

npm run install

development

this command will run both client and server development server. run it in root directory (not client or server).

npm run dev

deploy

customize the install command to follow the installation part, if start command failed, customize it to look like this npm start --prefix server, this is sometimes happen when npm cannot be used inside package.json a.k.a internal npm command through npm command. make sure you set NODE_ENV variable to "production".

note

if you deploy in a subroute of your hosting url, for example https://mysite.com/myproject:
in {root}/.env add

BASE_PATH = /myproject
VITE_BASENAME = /myproject

you could modify /myproject to follow your subroute of your hosting provider.

About

MERN Stack Authentication using Sequelize (MySQL as dialect) for backend template.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published